You are on page 1of 12

NAME: SIDDHARTH SAHU

REG NO: 18BEE0188


DIGITAL ASSIGNMENT 2
Title of the experiment : Cross and Auto correlation

Date: 18 December 2019


Experiment No:3
1. Aim : To find the cross and auto correlation of the signal

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');

%frequency domain signal%


n=256;
f=fft(s,n);
d=abs(f);
figure(2);
h=0:fs/n:fs-(fs/n);
plot(h,d);
title('spectrum of signals');
xlabel('frequency');
ylabel('amplitude');

%adding noise to a signal%


sn=awgn(s,0.5);
figure(3);
subplot(2,1,1);
plot(t,sn,'m');
fn=fft(sn,n);
title('signal n with noise');
xlabel('time');
ylabel('amplitude of noisy signal');

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

You might also like