Professional Documents
Culture Documents
DSPLAB2
DSPLAB2
2. Algorithm
• Take the inputs and store it in different variables
• Then calculate the lengths of both the arrays
• Take outer for loop for increment in the first input
• Take second loop for increment in second loop
• Then by formula calculate the cross correlation
• Store the values and display the graph
3. Program
Cross Correlation
Auto Correlation
4. Graph
5. Result
6. Inferences
The manual calculation matches with the matlab answer hence it verify that the code was
correct.
Title: Spectral analysis of signal with noise using FFT
Date: 8 January 2020
Experiment No 4
1.Aim: To perform Spectral analysis of signal with noise using FFT
2. Algorithm
• Generate 3 sinusoidal signals of10, 20, 30 Hz
• Add these signals to obtain a resultant signal
• Perform fft on the resultant signal and plot the spectrum of signal
• Create gaussian noise of the nature of resultant signal
• Perform fft of noise and plot the spectrum of signal with noise
• Plot the spectrum of noise
3. Program
clc
clear all
t=0:100;
fs=150;
s1=sin(2*pi*10*t/fs);
subplot(4,1,1);
plot(t,s1);
title('10 Hz signal');
xlabel('time');
ylabel('amplitude');
s2=sin(2*pi*20*t/fs);
subplot(4,1,2);
plot(t,s2);
title('20 Hz signal');
xlabel('time');
ylabel('amplitude');
s3=sin(2*pi*30*t/fs);
subplot(4,1,3);
plot(t,s3);
title('30 Hz signal');
xlabel('time');
ylabel('amplitude');
s=s1+s2+s3;
subplot(4,1,4);
plot(t,s);
title('Addition of 3 signal');
xlabel('time');
ylabel('amplitude');
dn=abs(fn);
subplot(2,1,2);
plot(h,dn);
xlabel('frequency');
ylabel('spectrum of noisy signal');
title('noisy spectrum')
4. Graph
5. Result
6. Inferences
Using FFT we can find the frequency spectrum of signal and by adding noise we can verify
the deviation in signal and spectrum