Professional Documents
Culture Documents
Exp No: 4
REG.NO:15BEE0305
Name: MADHANKUMAR.S
DATE:12/09/2017
AIM:
SOFTWARE REQUIRED:
MATLAB CODE:
clc;
clear all;
close all;
t=0:200;
n=256;
fs=150;
s1=sin(2*pi*10*t/fs);
subplot(4,1,1);
plot(s1);title('s1-10Hz signal');
s2=sin(2*pi*20*t/fs);
subplot(4,1,2);
plot(s2);title('s2-20Hz signal');
s3=sin(2*pi*50*t/fs);
subplot(4,1,3);
plot(s3);title('s3-50Hz signal');
xlabel('Time');
ylabel('Magnitude');
s=s1+s2+s3;
subplot(4,1,4);
plot(s3);title('s=s1+s2+s3 (sum of the signal)');
f=fft(s,n);
d=abs(f);
figure(2);
h=0:fs/n:fs-(fs/n);
plot(h,d);
xlabel('Frequency');
ylabel=('Magnitude');
title('spectra of the sum of the signals');
OUTPUT:
SPECTRAL ANALYSIS OF THE INPUT NOISE SIGNAL:
MATLAB CODE:
sn=awgn(s,0.6);
fn=fft(sn,n);
dn=abs(fn);
subplot(2,1,1);
plot(s,'-');hold on;
plot(sn,'k');
title('Input signal(blue)+Noise signal(Black)');
subplot(2,1,2);
plot(h,dn);
title('Spectra of the input signal with Noise');
OUTPUT:
RESULT:
We have done the spectral analysis of the given signal with noise and without
noise.