Matlab program to find effect of Noise on Message Signal when Amplitude and Phase are constant at every point, and also find at which point maximum noise is added.
Matlab code
clc;
close all;
clear all;
f=2;% Message Signal frequency.
A=1;% Message Signal Amplitude
Phase=0;% Message Signal Phase
snr=20; % Assume Signal to noise ratio is 20 db.
m=A*sin(2*pi*f*t); % Message Signal.
n=awgn(m,snr); % Adds White Gaussian Noise to signal m.
w=n-m; % Difference b/w Noise Added Signal & Message Signal.
z=abs(w); % Converting -ve value of w in to +ve value.
y=max(z);% Find maximum value of z.
x=find(z==y); % Returns a list of the positions (indices) of z satisfying the given condition.
plot(t,m,'--');
hold on;
plot(t,n,'r');
stem(t(x),n(x),'g','.');
text(t(x)+.005,n(x),'Maximum Noise');
xlabel('Time-->'Amplitude-->');
title('Effect of Noise on Message Signal');
legend('Message Signal without Noise','Message Signal with Noise');
No comments:
Post a Comment