Question

In: Computer Science

Using Matlab functions ‘fdesign’ and ‘design’, create the following filters (do not forget to create an...

Using Matlab functions ‘fdesign’ and ‘design’, create the following filters (do not forget to create an m file to write a script that should be printed in your report). [0.5] a-c each
(a) Low pass Hamming and low pass Hann filters, with cut off frequency Fc=300 Hz, sampling frequency Fs=2000 Hz, filter order N=100. Plot both filters on the same graph and use legend in the figure to mark each filter. Comment on the figure.
(b) Low pass Hamming filter and high pass Hamming filter with same specifications as in (a). Create a new figure and plot both filters on the same figure. Comment on the figure.
(c) Band pass Hamming with cut off frequencies Fc1=200 Hz, Fc2=400, N=100, sampling
frequency Fs=2KHz; Band pass Hamming with cut off frequencies Fc1=200 Hz, Fc2=400, N=50, sampling frequency Fs=2KHz. Create a figure with both filters. Comment on the figure.

Solutions

Expert Solution

a)Script:

clc;close all;clear all;

Fc=300;

Fs=2000;

wc=2*Fc/Fs;

N=100;

wH1=hamming(N+1)';

wH2=hann(N+1)';

hd=fir1(N,wc);

h1=hd.*wH1;

h2=hd.*wH2;

figure;[H1 f]=freqz(h1,1,1024,Fs);

[H2 f]=freqz(h2,1,1024,Fs);

subplot(211);plot(f,20*log10(abs(H1)));grid;

hold on;plot(f,20*log10(abs(H2)));

xlabel('f(Hz)');ylabel('|H|')

title('Magnitude response')

legend('Hamming','Hanning')

subplot(212);plot(f,angle(H1));grid;

hold on;

plot(f,angle(H2));

xlabel('f(Hz)');ylabel('<H>')

title('Phase response')

legend('Hamming','Hanning')

b)Script:

clc;close all;clear all;

Fc=300;Fs=2000;

wc=2*Fc/Fs;N=100;

wH=hamming(N+1)';

hd1=fir1(N,wc);

hd2=fir1(N,wc,'high');

h1=hd1.*wH;

h2=hd2.*wH;

figure;[H1 f]=freqz(h1,1,1024,Fs);

[H2 f]=freqz(h2,1,1024,Fs);

subplot(211);plot(f,20*log10(abs(H1)));grid;

hold on;plot(f,20*log10(abs(H2)));

xlabel('f(Hz)');ylabel('|H|')

title('Magnitude response')

legend('Low pass Hamming','High pass Hamming')

subplot(212);plot(f,angle(H1));grid;

hold on;

plot(f,angle(H2));

xlabel('f(Hz)');ylabel('<H>')

title('Phase response')

legend('Low pass Hamming','High pass Hamming')

C)Script:

clc;close all;clear all;

Fc1=200;Fc2=400;Fs=2000;

wc=2*[Fc1 Fc2]./Fs;N=100;

N=100;

wH=hamming(N+1)';

hd1=fir1(N,wc,'bandpass');

h1=hd1.*wH;

N=50;

wH=hamming(N+1)';

hd2=fir1(N,wc,'bandpass');

h2=hd2.*wH;

figure;[H1 f]=freqz(h1,1,1024,Fs);

[H2 f]=freqz(h2,1,1024,Fs);

subplot(211);plot(f,20*log10(abs(H1)));grid;

hold on;plot(f,20*log10(abs(H2)));

xlabel('f(Hz)');ylabel('|H|')

title('Magnitude response')

legend('Bandpass Hamming for N=100','Band pass Hamming for N=50')

subplot(212);plot(f,angle(H1));grid;

hold on;

plot(f,angle(H2));

xlabel('f(Hz)');ylabel('<H>')

title('Phase response')

legend('Bandpass Hamming for N=100','Band pass Hamming for N=50')


Related Solutions

Using PowerShell ISE or VSCode, create a PowerShell script that will do the following: Create functions...
Using PowerShell ISE or VSCode, create a PowerShell script that will do the following: Create functions to get the following information Local username Local machine name Time zone Current Date Output the data that was collected to the screen Upload the script. Paste a screenshot of the results here
How to design FIR lowpass filter using matlab. Note : Do not write matlab code. Only...
How to design FIR lowpass filter using matlab. Note : Do not write matlab code. Only explain the steps of designing filter
What I am trying to do is to design a Butterworth Bandpass filter using Matlab, High...
What I am trying to do is to design a Butterworth Bandpass filter using Matlab, High frequency must equal to 16 Hz and lower frequency must be 10Hz (passBand). and the input signal must be a white noise signal. here is my code : mu=0; sigma=2; X= sigma*randn(500,1)+mu; %Generating White Noise signal Fs=500;%Sampling Frequency Fh= 16; Fl=10; order=6; [b,a]=butter(order,[Fh Fl]/(Fs/2),'bandpass');%Butterworth BandPass filter XX=filtfilt(b,a,X);%filter the signal both forward and backword in time Actually, I am not sure about Fs value that...
Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft...
Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft and dft. Applied to discrete signals. If you can with an example.Thank you!!
Please C++ create a program that will do one of two functions using a menu, like...
Please C++ create a program that will do one of two functions using a menu, like so: 1. Do Catalan numbers 2. Do Fibonacci numbers (recursive) 0. Quit Enter selection: 1 Enter Catalan number to calculate: 3 Catalan number at 3 is 5 1. Do Catalan numbers 2. Do Fibonacci numbers (recursive) 0. Quit Enter selection: 2 Enter Fibonacci number to calculate: 6 Fibonacci number 6 is 8 Create a function of catalan that will take a parameter and return...
Matlab Design a FIR filter directly using fir1 function in matlab with parameter M = 50....
Matlab Design a FIR filter directly using fir1 function in matlab with parameter M = 50. Design FIR filters with different M = 5, 10, 50, 100, 500 and plot their frequency responses H(e j?) on the same figure.
a. Using Matlab scripts create the following matrices (???1 and ???2) ???1 = [ 3 2...
a. Using Matlab scripts create the following matrices (???1 and ???2) ???1 = [ 3 2 −3 6 7 4 3 −6 7 ], ???2 = [ 2 1 7 3 3 9 −6 6 1 ]    b. Write code to add the second row of ???1 to the third row of ???2 and store results in the first row of ???1. c. Write code to add the second column of ???1 with the third column of ???2 and...
This is a Matlab Exercise problem. Please create the Matlab code and figure for the following...
This is a Matlab Exercise problem. Please create the Matlab code and figure for the following problem using problem specifications: Plot x vs y when y=sin(x), y=cos(x), y=sin (2*x), and y=2*sin(x) when x = 1:0.1:10. Use 2 by 2 subplot, sin(x) is in location 1, cos(x) is in location 2, sin(2*x) is in location 3 and 2*sin(x) is in location 4. The plot should have: (1) x label = ‘x value’, y label = ‘y value’, legend ‘y=sin(x)’,’ y=cos(x)’,’ y=sin...
** USING MATLAB TO PROGRAM The main objective of this lab is to create a game...
** USING MATLAB TO PROGRAM The main objective of this lab is to create a game that involves betting on the sum of two dice. The player will start out with some initial total amount of money. During each round, the player can bet some money that the sum of the two dice will be equal to a certain number. If the player wins the bet, that player adds the amount of the bet to his or her current total....
Using the string functions below, write new functions to do the following, and test them in...
Using the string functions below, write new functions to do the following, and test them in your main() function: Determine whether the first or last characters in the string are any of the characters a, b, c, d, or e. Reverse a string Determine whether a string is a palindrome (spelled the same way forward or backward FUNCTIONS REFERENCE: string myString = "hello"; // say we have a string… // … we can call any of the following // string...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT