You are on page 1of 1

//Frequency components of a signal

//Build a noised signal samples at


1000Hz
clc
clf
sample_rate=1000
t=-3: 1/sample_rate:3
N=size(t,'*');//number of samples
s=exp(-t^2)
y=fft(s)//s is real so fft response is
conjugate symmetric and we retain
only the first N
f=sample_rate*(0:(N/2))/N;
n=size(f,'*')
subplot(2,1,1)
plot2d(t,s)
subplot(2,1,2)
a=gca();
plot2d(f,abs(y(1:n)))
a.data_bounds=[0,0;20,200]

You might also like