Nulling Filters for Rejection Nulling filters are filters t

. Nulling Filters for Rejection Nulling filters are filters that completely eliminate some frequency component. If the frequency is w = 0 or w = , then a two-point FIR filter will do the nulling. The simplest possible general nuling filter can have as few as three coefficients. If nis the desired nulling frequency, then the following length-3 FIR filter y[n] = x[n]-2 cos(un)r(n-1] + x[n-2] will have a zero in its frequency response at w wn. For example, a filter designed to completely eliminate signals of the form Ae0.5n would have the following coefficients because we would pick the desired nulling frequency to be an-0.5 bo = 1, b,--2 cos(0.5m) = 0, b2 = 1. (10) (a) Design a filtering system that consists of the cascade of two FIR nulling filters that will eliminate the following input frequencies: w 0.44 and w = 0.77. For this part derive the filter coefficients of both nulling filters (b) Generate an input signal rn that is the sum of three sinusoids [n] 5 cos(0.3n) 22 cos(0.44m-/3) + 22 cos(0.7:m-/4) (11) Make the input signal 150 samples long over the range 0n 149 (c) Use filter to filter the sum of three sinusoids signal [n]through the filters designed in part (a). Show the MATLAB code that you wrote to implement the cascade of two FIR filters.

Solution


% Generate the following windows with the length of each window should be 21.
% (a) Rectangular, (b) Hanning, (c) Hamming and (d) Kaiser window
% Also sketch the Frequency (magnitude) responses of the above windows.
%
% Solution                                                                                                                                  

clear all; close all; clc;

% Rect window
N=21;
Rw=boxcar(N);
[h,omega1]=freqz(Rw,1,256);% frequency response of the window
mag1=20*log10(abs(h)); %DB magnitude

% hanning window
Hnw=hanning(N);
[h,omega2]=freqz(Hnw,1,256);% frequency response of the window
mag2=20*log10(abs(h)); %DB magnitude

% hamming window
Hmw=hamming(N);
[h,omega3]=freqz(Hmw,1,256);% frequency response of the window
mag3=20*log10(abs(h)); %DB magnitude

%kaisar
alpha = 5;
kw=kaiser(N,alpha);
[h,omega4]=freqz(kw,1,256);% frequency response of the window
mag4=20*log10(abs(h)); %DB magnitude

%-------------------Time domain plots -----------------------------

n = 0: N-1;
figure()
subplot(2,2,1); stem(n, Rw,\'r\',\'fill\',\'LineWidth\',1.5); grid
xlabel(\'Time index ------>\');
ylabel(\'Magnitude--->\');
title(\'Rectangular Window\');
axis([-1 N -0.05 1.2]);

subplot(2,2,2); stem(n, Hnw,\'b\',\'fill\',\'LineWidth\',1.5); grid
xlabel(\'Time index ------>\');
ylabel(\'Magnitude--->\');
title(\'Hanning Window\');
axis([-1 N -0.05 1.2]);


subplot(2,2,3); stem(n, Hmw,\'k\',\'fill\',\'LineWidth\',1.5); grid
xlabel(\'Time index ------>\');
ylabel(\'Magnitude--->\');
title(\'Hamming Window\');
axis([-1 N -0.05 1.2]);


subplot(2,2,4); stem(n, kw,\'m\',\'fill\',\'LineWidth\',1.5); grid
xlabel(\'Time index ------>\');
ylabel(\'Magnitude--->\');
title(\'Kaiser Window\');
axis([-1 N -0.05 1.2]);

%-----------------Frequency Response--------------------------
figure()
plot(omega1/pi,mag1,\'r\',omega2/pi,mag2,\'k\',omega3/pi,mag3,\'m\',omega4/pi,mag4,\'c\',\'LineWidth\',2);
xlabel(\'Normalized frequency\');
ylabel(\'Gain DB\');grid
legend(\'Rectangular\',\'Hanning\',\'Hamming\',\'kaiser\');
title(\'Frequency Responses of Windows\');

%V10_2.m: Design a low-pass FIR filter using Rectangular window

% Design a low-pass FIR filter, with cut-off frequency of 5 kHz, length 11
% using rectangular window. Assume the sampling frequency is 50 kHz.
% Find the filter coefficients, measure the magnitude and phase
% responses and comment. Plot the magnitude and phase versus real frequency f in Hz.
%
% Solution                                                                                                                                   
% Cut-off frequency given is 5kHz = 0.2 radians/sec
% rectangular window

clear all; close all; clc;

N=11;
Rw=boxcar(N);
b=fir1(10,0.2,Rw);
disp(\'window coefficient = \');disp(Rw\')

[h,f]=freqz(b,1,512);% frequency response of the window
mag = 20*log10(abs(h)); %DB magnitude
an = angle(h);

%------------------------------------------------------------------------
n = 0:N-1;
figure(); stem(n, Rw,\'m\',\'fill\',\'LineWidth\',1.5); grid
xlabel(\'Time index ------>\');
ylabel(\'Magnitude--->\');
title(\'Rectangular Window\');
axis([-1 N -0.05 1.05]);

%------------------------------------------------------------------------
% Magnitude Response
figure();
subplot(2,1,1);plot(f,mag,\'r\',\'LineWidth\',1.5); grid
xlabel(\'Real frequency ----->\');ylabel(\'Gain DB ----->\');
title(\'Magnitude Response\');

% Phase response
phase = angle(h);
subplot(2,1,2); plot(f,phase,\'b\',\'LineWidth\',1.5);
xlabel(\'Real frequency ---->\');ylabel(\'Angle in Radians ---->\');
title(\'Phase response\'); grid
%------------------------------------------------------------------------


% Result                                                                                                                                      
%
% Filter coefficient
%
% b =
% % 0.00000000000000   0.03989988227886   0.08607915423243   0.12911873134864
% 0.15959952911546   0.17060540604922   0.15959952911546   0.12911873134864
% 0.08607915423243   0.03989988227886   0.00000000000000

% Window coefficient
% 1     1     1     1     1     1     1     1     1     1     1

% Comments:
% % Cut-off frequency given is 5kHz = 0.2 radians/sec (shown in freq. response
% figure)...................ok
% % Ripples are observed at less than -20dB..............................ok
% % In Phase response we observe linear responses......................ok
% % Which show that overall response is satisfactory.

 . Nulling Filters for Rejection Nulling filters are filters that completely eliminate some frequency component. If the frequency is w = 0 or w = , then a two-p
 . Nulling Filters for Rejection Nulling filters are filters that completely eliminate some frequency component. If the frequency is w = 0 or w = , then a two-p
 . Nulling Filters for Rejection Nulling filters are filters that completely eliminate some frequency component. If the frequency is w = 0 or w = , then a two-p

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site