windows.m
% windows.m
% This is a script file to demonstrate DSP window
% Characteristics in both the time and frequency domain.
%
clg, clear
clc
t = linspace(0,.256,256);
x1 = sin(2*pi*50*t);
x2 = sin(2*pi*120*t);
x=x1+x2;
rand('normal')
y = x;
% y = x + 2*rand(t);
y(1)=1+j*0;
y(2)=0.5+j*0;
% x=[];t=[];
clc
plot(y(1:50)), title('Noisy time domain signal'), pause
Y = fft(y,256);
% The power spectral density
Pyy = Y.*conj(Y)/256;
clc
f = 1000/256*(0:127);
plot(f,Pyy(1:128)), title('Power spectral density'), ..
xlabel('Frequency (Hz)'), pause
clc
plot(f(1:50),Pyy(1:50)), title('Power spectral density'), ..
xlabel('Frequency (Hz)'), pause
rand('uniform')
clc