Exp 6 -To find spectral component of signal
t=0:0.001:0.6;
x=sin(2*pi*50*t)+sin(2*pi*400*t)+sin(2*pi*100*t);
y=x+randn(size(t))
figure();
plot(100*t(1:50),y(1:50))
z=fft(y,512);
P=z.*conj(z)/512;
f=1000*(0:256)/512;
figure();
plot(f,P(1:257));
Output4
3
2
1
0
-1
-2
-3
-4
0.5
1.5
2.5
3.5
4.5
400
450
500
120
100
80
60
40
20
50
100
150
200
250
300
350