0% found this document useful (0 votes)
30 views22 pages

SSP Lab1

The document presents the results of an experiment with an FIR filter on different noisy signals. It specifies the filter parameters, generates the original, noisy and estimated signals, and calculates the SNR for each. Signal and PSD plots are provided, and inferences are made about how the SNR and filter performance changes with different parameters.

Uploaded by

Syamantak Sarkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views22 pages

SSP Lab1

The document presents the results of an experiment with an FIR filter on different noisy signals. It specifies the filter parameters, generates the original, noisy and estimated signals, and calculates the SNR for each. Signal and PSD plots are provided, and inferences are made about how the SNR and filter performance changes with different parameters.

Uploaded by

Syamantak Sarkar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

NATIONAL INSTITUTE OF TECHNOLOGY

CALICUT

Department of Electronics & Communication


Engineering

Name: Syamantak Sarkar


Roll No.: M230922EC

Statistical Signal Processing Lab


Assignment 1
FIR filter Specifications:
alpha = 0.4; sigma^2 = 0.25, D =1, A=0.1, P=2

Code:

% L=2, alpha = 0.4; sigma^2 = 0.25, D =1, A=0.1, P=2


clear all;
close all;
clc;
N=100;
alpha =0.4;
a = 0.1;
P = 2;
sigma_2 = 0.25;
v = randn(1,N);
x = zeros(N);
x(1) = v(1);
y = zeros(N);
k = -N/2:1:N/2-1;
r_x = P * alpha.^abs(k);
% random signal generation
for i = 2:1:N
x(i) = alpha*x(i-1) + v(i);
end
subplot(5,1,1);
stem(k,x);
title('Generated Random Signal (X)');
%subplot(4,1,2);
%stem(k,r_x);
%title('Autocorrelated Function (r_x)');
% noisy signal generation
r = normrnd(0,sqrt(sigma_2),N);
for i = 2:1:N
y(i) = x(i)+ a*x(i-1) + r(i);
end
subplot(5,1,2);
stem(k,y);
title('Y (Noisy Signal)');
% estimated signal X_hat calculation
x_hat = zeros(N);
% mathematical
A = [2.43 1.04; 1.04 2.43];
B = [2.08 ;0.83];
W = inv(A )*B;
w0 = W(1);
w1 = W(2);
for i = 2:1:N
x_hat(i) = w0*y(i) + w1*y(i-1);
end
subplot(5,1,3);
stem(k,x_hat);
title('x_h (Estimated Signal)');
e = zeros(N);
for i = 2:1:N
e(i) = x(i) - x_hat(i);
end
subplot(5,1,4);
stem(k,e);
title('error signal');
m = zeros(N);
for i = 2:1:N
m(i) = y(i) - x(i);
end
subplot(5,1,5);
stem(k,m);
title('x(n) -y(n)');
% Error and SNR claculation of the estimated signal
MMSE =P - B.' * W;
fprintf('Minimum Mean Squared Error(Estimated)\n');
disp(MMSE);
SNR = P/MMSE;
fprintf('Signal to Noise Ratio(Estimated)\n');
disp(SNR);
% Error and SNR calculation of noisy signal
Total_noise_power = a*a*2 +sigma_2;
SNR_original = P/Total_noise_power;
fprintf('Signal to Noise Ratio(Original)\n');
disp(SNR_original);
fprintf('SNR(Estimated) is improved that SNR(Original )');
% Power Spectral Density of the random signal
N=100;
w = -pi:0.0001:pi;
neu = 1-alpha*alpha;
deno = P*(1+alpha*alpha-2*alpha*cos(w));
p_x = (neu)./(deno);
figure;
subplot(3,1,1);
Fs = 8000;
fq = (w*Fs)/(2*pi);
plot(fq,p_x);
title('Power spectral density of x')
p_y = ((1+a^2)+ 2*a*cos(w)).*p_x + sigma_2;
% Power Spectral Density of Noisy signal
subplot(3,1,2);
plot(fq,p_y);
title('Power spectral density of y')
% Power Spectral Density of Estimated signal
p_x_hat = (w0^2 +w1^2+2*w0*w1*cos(w) ).*p_y;
subplot(3,1,3);
plot(fq,p_x_hat);
title('Power spectral density of x_h')

Output:
SNR value calculation:

Minimum Mean Squared Error(Estimated)


0.2178

Signal to Noise Ratio(Estimated)


9.1843

Signal to Noise Ratio(Original)


7.4074
Signal plots:

PSD of x(n), y(n), and x_hat(n):

Inferences:
As you can see for the first FIR filter we have taken the following specification (alpha = 0.4; sigma^2
= 0.25, D =1, A=0.1, P=2).
• The signal to noise ratio for the noisy signal is 7.40.
• The signal to noise ratio for the estimated signal for L2 tap is 9.18.
• So, there is a significant increase in the SNR for estimated signal.
• From a signal plot we can see that the range of error signal is much lesser than x(n) – y(n).
• From the power spectral density curves we can see that the estimated signal is close to the
original signal.
• And the Noisy signal y(n) He’s going to the sigma^2(in this case 0.25) value when n tends to
infinity.
• PSD at f = 0 Hz is 2.3
So the frequency value corresponding to the PSD value 1.15 = 1350.2 Hz
That is bandwidth is 1350.2 Hz

FIR filter Specifications:


alpha = 0.3; sigma^2 = 0.3, D =1, A=0.5, P=1

Code:
% L=2, alpha = 0.3; sigma^2 = 0.3, D =1, A=0.5, P=1

clear all;
close all;
clc;
N=100;
alpha =0.3;
a = 0.5;
P = 1;
sigma_2 = 0.3;
v = randn(1,N);
x = zeros(N);
x(1) = v(1);
y = zeros(N);
k = -N/2:1:N/2-1;
r_x = P * alpha.^abs(k);
% random signal generation
for i = 2:1:N
x(i) = P*alpha*x(i-1) + v(i);
end
subplot(5,1,1);
stem(k,x);
title('Generated Random Signal (X)');
%subplot(4,1,2);
%stem(k,r_x);
%title('Autocorrelated Function (r_x)');
% noisy signal generation
r = normrnd(0,sqrt(sigma_2),N);
for i = 2:1:N
y(i) = x(i)+ a*x(i-1) + r(i);
end
subplot(5,1,2);
stem(k,y);
title('Y (Noisy Signal)');
% estimated signal X_hat calculation
x_hat = zeros(N);
A = [1.85 0.92; 0.92 1.85];
B = [1.15 ;0.345];
W = inv(A )*B;
w0 = W(1);
w1 = W(2);
for i = 2:1:N
x_hat(i) = w0*y(i) + w1*y(i-1);
end
subplot(5,1,3);
stem(k,x_hat);
title('x_h (Estimated Signal)');
e = zeros(N);
for i = 2:1:N
e(i) = x(i) - x_hat(i);
end
subplot(5,1,4);
stem(k,e);
title('error signal');
m = zeros(N);
for i = 2:1:N
m(i) = y(i) - x(i);
end
subplot(5,1,5);
stem(k,m);
title('x(n) -y(n)')
% Error and SNR claculation of the estimated signal
MMSE = P - B.' * W;
fprintf('Minimum Mean Squared Error(Estimated)\n');
disp(MMSE);
SNR = P/MMSE;
fprintf('Signal to Noise Ratio(Estimated)\n');
disp(SNR);
% Error and SNR calculation of noisy signal
Total_noise_power = a*a*P +sigma_2;
SNR_original = P/Total_noise_power;
fprintf('Signal to Noise Ratio(Original)\n');
disp(SNR_original);
fprintf('SNR(Estimated) is improved that SNR(Original )');
% Power Spectral Density of the random signal
N=100;
w = -3:0.0001:3;
neu = 1-alpha*alpha;
deno = P*(1+alpha*alpha-2*alpha*cos(w));
p_x = (neu)./(deno);
figure;
subplot(3,1,1);
Fs = 8000;
fq = (w*Fs)/(2*pi);
plot(fq,p_x);
title('Power spectral density of x')
p_y = ((1+a^2)+ 2*a*cos(w)).*p_x + sigma_2;
% Power Spectral Density of Noisy signal
subplot(3,1,2);
plot(fq,p_y);
title('Power spectral density of y')
% Power Spectral Density of Estimated signal
p_x_hat = (w0^2 +w1^2+2*w0*w1*cos(w) ).*p_y;
subplot(3,1,3);
plot(fq,p_x_hat);
title('Power spectral density of x_h')
Output:
SNR value calculation:

Minimum Mean Squared Error(Estimated)


0.2482

Signal to Noise Ratio(Estimated)


4.0296

Signal to Noise Ratio(Original)


1.8182
Signal plots:

PSD of x(n), y(n), and x_hat(n):


Inferences:
As you can see for the first FIR filter we have taken the following specification (alpha = 0.3; sigma^2
= 0.3, D =1, A=0.5, P=1).
• The signal to noise ratio for the noisy signal is 1.81.
• The signal to noise ratio for the estimated signal for L2 tap is 4.03.
• So, there is a significant increase in the SNR for estimated signal.
• From a signal plot we can see that the range of error signal is much lesser than x(n) – y(n).
• From the power spectral density curves we can see that the estimated signal is close to the
original signal.
• And the Noisy signal y(n) He’s going to the sigma^2(in this case 0.3) value when n tends to
infinity.
• As we can see the SNR value is smaller than the previous one because here we’re taking P = 1
that is decreasing the overall SNR value both in case of noisy signal and estimated signal.
• The MMSE is 0.25 Which is higher than the previous case because here the power of the
noise increases due to the increase in sigma^2 and A.

FIR filter Specifications:


alpha = 0.7; sigma^2 = 0.25, D =1, A=1.5, P=1

Code:
% L=2, alpha = 0.7; sigma^2 = 0.25, D =1, A=1.5, P=1

clear all;
close all;
clc;
N=100;
alpha =0.7;
a = 1.5;
P = 1;
sigma_2 = 0.25;
v = randn(1,N);
x = zeros(N);
x(1) = v(1);
y = zeros(N);
k = -N/2:1:N/2-1;
r_x = P * alpha.^abs(k);
% random signal generation
for i = 2:1:N
x(i) = P*alpha*x(i-1) + v(i);
end
subplot(4,1,1);
stem(x);
title('Generated Random Signal (X)');
subplot(4,1,2);
stem(k,r_x);
title('Autocorrelated Function (r_x)');
% noisy signal generation
r = normrnd(0,sqrt(sigma_2),N);
for i = 2:1:N
y(i) = x(i)+ a*x(i-1) + r(i);
end
subplot(4,1,3);
stem(k,y);
title('Y (Noisy Signal)');
% estimated signal X_hat calculation
x_hat = zeros(N);
A = [5.6 4.51; 4.51 5.6];
B = [2.05 ;1.435];
W = inv(A )*B;
w0 = W(1);
w1 = W(2);
for i = 2:1:N
x_hat(i) = w0*y(i) + w1*y(i-1);
end
subplot(4,1,4);
stem(k,x_hat);
title('x_h (Estimated Signal)');
% Error and SNR claculation of the estimated signal
MMSE = P - B.' * W;
fprintf('Minimum Mean Squared Error(Estimated)\n');
disp(MMSE);
SNR = P/MMSE;
fprintf('Signal to Noise Ratio(Estimated)\n');
disp(SNR);
% Error and SNR calculation of noisy signal
Total_noise_power = a*a*P +sigma_2;
SNR_original = P/Total_noise_power;
fprintf('Signal to Noise Ratio(Original)\n');
disp(SNR_original);
fprintf('SNR(Estimated) is improved that SNR(Original )');
% Power Spectral Density of the random signal
N=100;
w = -3:0.0001:3;
neu = 1-alpha*alpha;
deno = P*(1+alpha*alpha-2*alpha*cos(w));
p_x = (neu)./(deno);
figure;
subplot(3,1,1);
Fs = 8000;
fq = (w*Fs)/(2*pi);
plot(fq,p_x);
title('Power spectral density of x')
p_y = ((1+a^2)+ 2*a*cos(w)).*p_x + sigma_2;
% Power Spectral Density of Noisy signal
subplot(3,1,2);
plot(fq,p_y);
title('Power spectral density of y')
% Power Spectral Density of Estimated signal
p_x_hat = (w0^2 +w1^2+2*w0*w1*cos(w) ).*p_y;
subplot(3,1,3);
plot(fq,p_x_hat);
title('Power spectral density of x_h')

Output:
SNR value calculation:

Minimum Mean Squared Error(Estimated)


0.2258

Signal to Noise Ratio(Estimated)


4.4278

Signal to Noise Ratio(Original)


0.4000

Signal plots:
PSD of x(n), y(n), and x_hat(n):

Inferences:
As you can see for the first FIR filter we have taken the following specification (alpha = 0.7; sigma^2
= 0.25, D =1, A=1.5, P=1).
• The signal to noise ratio for the noisy signal is 0.4.
• The signal to noise ratio for the estimated signal for L2 tap is 4.42.
• So, there is a significant increase in the SNR for estimated signal.
• From a signal plot we can see that the range of error signal is almost same as x(n) – y(n). This
is because due to A=1.5 the main component of noisy signal is the echo.
• From the power spectral density curves we can see that the estimated signal is close to the
original signal.
• As we can see the SNR value is smaller than the previous one because here we’re taking P = 1
that is decreasing the overall SNR value both in case of noisy signal and estimated signal.
• The MMSE is 0.225 ,which is higher than the previous case because here the power of the
noise increases due to the increase in sigma^2 and A.
• The main part of noise power is the power of echo signal.

FIR filter Specifications:


alpha = 0.4; sigma^2 = 0.25, D =1, A=0.1, P=1

Code:
% L=2, alpha = 0.4; sigma^2 = 0.25, D =1, A=0.1, P=1
%FIR
clear all;
close all;
clc;
N=100;
alpha =0.4;
sigma_2 =0.25;
P = 1;
a=0.1;
v = randn(1,N);
x = zeros(N);
x(1) = v(1);
y = zeros(N);
k = -N/2:1:N/2-1;
r_x = P * alpha.^abs(k);
% random signal generation
for i = 2:1:N
x(i) = P*alpha*x(i-1) + v(i);
end
subplot(5,1,1);
stem(k,x);
title('Generated Random Signal (X)');
%subplot(4,1,2);
%stem(k,r_x);
%title('Autocorrelated Function (r_x)');
% noisy signal generation
r = normrnd(0,sqrt(sigma_2),N);
for i = 2:1:N
y(i) = x(i)+ a*x(i-1) + r(i);
end
subplot(4,1,2);
stem(k,y);
title('Y (Noisy Signal)');
% estimated signal X_hat calculation
x_hat = zeros(N);
A = [1.85 0.92; 0.92 1.85];
B = [1.15 ;0.345];
W = inv(A )*B;
w0 = W(1);
w1 = W(2);
for i = 2:1:N
x_hat(i) = w0*y(i) + w1*y(i-1);
end
subplot(4,1,3);
stem(k,x_hat);
title('x_h (Estimated Signal)');
e = zeros(N);
for i = 2:1:N
e(i) = x(i) - x_hat(i);
end
subplot(5,1,4);
stem(k,e);
title('error signal');
m = zeros(N);
for i = 2:1:N
m(i) = y(i) - x(i);
end
subplot(5,1,5);
stem(k,m);
title('x(n) -y(n)')
% Error and SNR claculation of the estimated signal
MMSE = P - B.' * W;
fprintf('Minimum Mean Squared Error(Estimated)\n');
disp(MMSE);
SNR = P/MMSE;
fprintf('Signal to Noise Ratio(Estimated)\n');
disp(SNR);
% Error and SNR calculation of noisy signal
Total_noise_power = a*a*P +sigma_2;
SNR_original = P/Total_noise_power;
fprintf('Signal to Noise Ratio(Original)\n');
disp(SNR_original);
fprintf('SNR(Estimated) is improved that SNR(Original )');
% Power Spectral Density of the random signal
N=100;
w = -3:0.0001:3;
neu = 1-alpha*alpha;
deno = P*(1+alpha*alpha-2*alpha*cos(w));
p_x = (neu)./(deno);
figure;
subplot(3,1,1);
Fs = 8000;
fq = (w*Fs)/(2*pi);
plot(fq,p_x);
title('Power spectral density of x')
p_y = ((1+a^2)+ 2*a*cos(w)).*p_x + sigma_2;
% Power Spectral Density of Noisy signal
subplot(3,1,2);
plot(fq,p_y);
title('Power spectral density of y')
% Power Spectral Density of Estimated signal
p_x_hat = (w0^2 +w1^2+2*w0*w1*cos(w) ).*p_y;
subplot(3,1,3);
plot(fq,p_x_hat);
title('Power spectral density of x_h')

Output:
SNR value calculation:

Minimum Mean Squared Error(Estimated)


0.2482

Signal to Noise Ratio(Estimated)


4.0296

Signal to Noise Ratio(Original)


3.8462
Signal plots:
PSD of x(n), y(n), and x_hat(n):

Inferences:
As you can see for the first FIR filter we have taken the following specification (alpha = 0.4; sigma^2
= 0.25, D =1, A=0.1, P=1).
• The signal to noise ratio for the noisy signal is 3.84.
• The signal to noise ratio for the estimated signal for L2 tap is 4.03.
• So, there is a significant increase in the SNR for estimated signal.
• From a signal plot we can see that the range of error signal is much lesser than x(n) – y(n).
• From the power spectral density curves we can see that the estimated signal is close to the
original signal.
• And the Noisy signal y(n) He’s going to the sigma^2(in this case 0.25) value when n tends to
infinity.
• The overall SNR value decreases because the overall power also decreases for P=1.

IIR filter Specifications:


alpha = 0.4; sigma^2 = 0.25, D =1, A=0.1, P=1

Code:
%IIR filter
% L=2, alpha = 0.4; sigma^2 = 0.25, D =1, A=0.1, P=1

clear all;
close all;
clc;
N=100;
alpha =0.4;
sigma_2 =0.25;
P = 1;
a=0.1;
v = randn(1,N);
x = zeros(N);
x(1) = v(1);
y = zeros(N);
k = -N/2:1:N/2-1;
r_x = P * alpha.^abs(k);
% random signal generation
for i = 2:1:N
x(i) = P*alpha*x(i-1) + v(i);
end
subplot(5,1,1);
stem(x);
title('Generated Random Signal (X)');
%subplot(4,1,2);
%stem(k,r_x);
%title('Autocorrelated Function (r_x)');
% noisy signal generation
w = normrnd(0,sqrt(sigma_2),N);
for i = 2:1:N
y(i) = x(i)+ a*x(i-1) + w(i);
end
subplot(5,1,2);
stem(k,y);
title('Y (Noisy Signal)');
% estimated signal X_hat calculation
x_hat = zeros(N);
B = [2.08 ;0.83; 0.18];
w0 = 0.08;
w1 = 0.74;
w2 = 0.01;
W = [w0 ;w1 ;w2];
for i = 2:1:N
x_hat(i) = 0.74*y(i) + 0.01*y(i-1)+ 0.08*y(i+1);
end
subplot(5,1,3);
stem(k,x_hat);
title('x_h (Estimated Signal)');
e = zeros(N);
for i = 2:1:N
e(i) = x(i) - x_hat(i);
end
subplot(5,1,4);
stem(k,e);
title('error signal');
m = zeros(N);
for i = 2:1:N
m(i) = y(i) - x(i);
end
subplot(5,1,5);
stem(k,m);
title('x(n) -y(n)')
% Error and SNR claculation of the estimated signal
MMSE = P - B.' * W;
fprintf('Minimum Mean Squared Error(Estimated)\n');
disp(MMSE);
SNR = P/MMSE;
fprintf('Signal to Noise Ratio(Estimated)\n');
disp(SNR);
% Error and SNR calculation of noisy signal
Total_noise_power = a*a*P +sigma_2;
SNR_original = P/Total_noise_power;
fprintf('Signal to Noise Ratio(Original)\n');
disp(SNR_original);
fprintf('SNR(Estimated) is improved that SNR(Original )');
% Power Spectral Density of the random signal
N=100;
w = -pi:0.0001:pi;
alpha =0.4;
neu = 1-alpha*alpha;
deno = (1+alpha*alpha-2*alpha*cos(w));
p_x = (neu)./(deno);
figure;
subplot(2,1,1);
Fs = 8000;
fq = (w*Fs)/(2*pi);
plot(fq,p_x);
title('Power spectral density of x')
p_y = (1.01+ 0.2*cos(w)).*p_x + sigma_2;
% Power Spectral Density of Noisy signal
subplot(2,1,2);
plot(fq,p_y);
title('Power spectral density of y')
Power Spectral Density of Estimated signal
p_x_hat = (w0^2 +w1^2+2*w0*w1*cos(w) ).*p_y;
subplot(3,1,3);
plot(w,p_x_hat);
title('Power spectral density of x_h')

Output:
SNR value calculation:
Minimum Mean Squared Error(Estimated)
0.2176

Signal to Noise Ratio(Estimated)


4.5956

Signal to Noise Ratio(Original)


3.8462
Signal plots:

PSD of x(n), y(n), and x_hat(n):


Inferences:
As you can see for the first IIR filter we have taken the following specification (alpha = 0.4; sigma^2
= 0.25, D =1, A=0.1, P=2). This has the same specification as the previous IIR filter.
• The signal to noise ratio for the noisy signal is 3.84.
• The signal to noise ratio for the estimated signal for L2 tap is 4.60.
• So, there is a significant increase in the SNR for estimated signal.
• From a signal plot we can see that the range of error signal is much lesser than x(n) – y(n).
• From the power spectral density curves we can see that the estimated signal is close to the
original signal.
• And the Noisy signal y(n) He’s going to the sigma^2(in this case 0.25) value when n tends to
infinity.
• As we can see the SNR in case of estimated signal is higher in case of IIR than FIR filter.

FIR filter Specifications with coloured noise:


alpha = 0.4; sigma^2 = 0.25, D =1, A=0.1, P=1

Code:
%cloured noise FIR
% L=2, alpha = 0.4; sigma^2 = 0.25, D =1, A=0.1, P=1

clear all;
close all;
clc;
N=100;
alpha =0.4;
sigma_2 =0.25;
P = 1;
a=0.1;
v = randn(1,N);
x = zeros(N);
x(1) = v(1);
y = zeros(N);
k = -N/2:1:N/2-1;
r_x = P * alpha.^abs(k);
% random signal generation
for i = 2:1:N
x(i) = P*alpha*x(i-1) + v(i);
end
subplot(5,1,1);
stem(x);
title('Generated Random Signal (X)');
%subplot(5,1,2);
%stem(k,r_x);
%title('Autocorrelated Function (r_x)');
% noisy signal generation
r = zeros(N);% White Noise
for i = 2:1:N
r(i) = sqrt(sigma_2/2)*v(i-1) + sqrt(sigma_2/2)*v(i);
end
for i = 2:1:N
y(i) = x(i)+ a*x(i-1) + r(i);
end
subplot(5,1,2);
stem(k,y);
title('Y (Noisy Signal)');
% estimated signal X_hat calculation
x_hat = zeros(N);
A = [1.34 0.645; 0.645 1.34];
B = [1.04 ;0.42];
W = inv(A)*B;
w0 = W(1);
w1 = W(2);
for i = 2:1:N
x_hat(i) = w0*y(i) + w1*y(i-1);
end
subplot(5,1,3);
stem(k,x_hat);
title('x_h (Estimated Signal)');
e = zeros(N);
for i = 2:1:N
e(i) = x(i) - x_hat(i);
end
subplot(5,1,4);
stem(k,e);
title('error signal');
m = zeros(N);
for i = 2:1:N
m(i) = y(i) - x(i);
end
subplot(5,1,5);
stem(k,m);
title('x(n) -y(n)')
% Error and SNR claculation of the estimated signal
MMSE = P - B.' * W;
fprintf('Minimum Mean Squared Error(Estimated)\n');
disp(MMSE);
SNR = P/MMSE;
fprintf('Signal to Noise Ratio(Estimated)\n');
disp(SNR);
% Error and SNR calculation of noisy signal
Total_noise_power = a*a*P +sigma_2;
SNR_original = P/Total_noise_power;
fprintf('Signal to Noise Ratio(Original)\n');
disp(SNR_original);
fprintf('SNR(Estimated) is improved that SNR(Original )');
% Power Spectral Density of the random signal
N=100;
w = -3:0.0001:3;
neu = 1-alpha*alpha;
deno = P*(1+alpha*alpha-2*alpha*cos(w));
p_x = (neu)./(deno);
figure;
subplot(3,1,1);
Fs = 8000;
fq = (w*Fs)/(2*pi);
plot(fq,p_x);
title('Power spectral density of x')
p_y = ((1+a^2)+ 2*a*cos(w)).*p_x + sigma_2*(1+cos(w));
% Power Spectral Density of Noisy signal
subplot(3,1,2);
plot(fq,p_y);
title('Power spectral density of y')
% Power Spectral Density of Estimated signal
p_x_hat = (w0^2 +w1^2+2*w0*w1*cos(w) ).*p_y;
subplot(3,1,3);
plot(fq,p_x_hat);
title('Power spectral density of x_h')
Output:
SNR value calculation:

Minimum Mean Squared Error(Estimated)


0.1865

Signal to Noise Ratio(Estimated)


5.3612

Signal to Noise Ratio(Original)


3.8462
Signal plots:
PSD of x(n), y(n), and x_hat(n):

Inferences:
As you can see for the first FIR filter we have taken the following specification (alpha = 0.4; sigma^2
= 0.25, D =1, A=0.1, P=2). But in this case we are taking coloured noise rather than white noise.
• The signal to noise ratio for the noisy signal is 3.84.
• The signal to noise ratio for the estimated signal for L2 tap is 5.36.
• So, there is a significant increase in the SNR for estimated signal.
• From a signal plot we can see that the range of error signal is much lesser than x(n) – y(n).
• From the power spectral density curves we can see that the estimated signal is close to the
original signal.
• And the Noisy signal y(n) He’s going to the sigma^2(in this case 0.25) value when n tends to
infinity.
• In case of coloured noise the snr improvement is the highest.

In the following section some of the theoretical calculations are added which is needed to implement
the above experiments.

You might also like