0% found this document useful (0 votes)
29 views

MATLAB Question Solution Problem 9: Solution

This MATLAB code estimates a channel model from noisy frequency response data, validates the model by comparing it to the original data, and uses inverse filtering to restore the original data from the noisy received data. It loads channel data, plots the noisy frequency response, estimates an inverse filter model, validates the model, and applies the inverse filter to restore the original data, plotting the original, noisy, and restored signals.

Uploaded by

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

MATLAB Question Solution Problem 9: Solution

This MATLAB code estimates a channel model from noisy frequency response data, validates the model by comparing it to the original data, and uses inverse filtering to restore the original data from the noisy received data. It loads channel data, plots the noisy frequency response, estimates an inverse filter model, validates the model, and applies the inverse filter to restore the original data, plotting the original, noisy, and restored signals.

Uploaded by

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

MATLAB Question Solution

Problem 9:

Solution:

MATLAB code:
%hw553714
clc;clear;close all

load hw553714 % loads w, H(w), Noisy Data y(n), Original Data x(n)
%Note - Original data is given here only for illustration

figure(1)
plot(w,abs(Hw),'-*') %Plot noisy channel frequency response data
title('Noisy Frequency response of the channel ');

[Num_H,den_H]=invfreqz(Hw,w,1,0) %Esimated Channel Model


Poles_of_inv_filter=roots(Num_H); % To make sure Inverse filter "1/H" is
stable

%Model Validation
figure(2)
plot(w,abs(Hw),'-*')
title('Frequency response of the channel ')
hold on;
[ModelHw,w]=freqz(Num_H,den_H);
plot(w,abs(ModelHw),'-r')
title('Model Validation - |H(w)| (Blue) and |Model-H(w)| (Red) ')
hold off;

% Inverse filtering to restore original data


yf=filter(den_H,Num_H,y); %filter y(n) to restore x(n)
figure(3)
n=[1:length(x)]';
%plot([x y yf])
plot(n,x,'k',n,y,'b',n,yf,'r')
title('Plots of Original Data (Black), Noisy Data (Blue), and Restored (Inv-
Filter) data (Red)')
output in command window:

Plot of abs (Hw) against w:

Figure 9.1 Plot of abs (Hw) Vs. w


Frequency response of the channel:

Figure 9.2 Frequency channel response

Plot of Yf(n):

Figure9. 3 Plot of Yf(n)

You might also like