Question

In: Electrical Engineering

2. Design a digital lowpass filter to meet the following specifications: passband edge = 0:45π stopband...

2. Design a digital lowpass filter to meet the following specifications:
passband edge = 0:45π
stopband edge = 0:5π
Rp = 0.5 dB, As = 60 dB

a. Design a Buttterworth filter, you may use the butteworth and butter commands to implement.

b. Design Chebyshev Type 1 filter ( use the equivalent commands to above )

c. Design an Elliptic filter ( use the equivalent commands to part a ).

d. List the order of each filter and find the actual Rp and As for each filter. To find the ripple
and attenuation values you should use freqz to output the frequency response h and frequency w
values to a vector at enough points , say 1000, then use the min or max commands to find the
min or max in the passband or stopband range in the frequency response. You may need to use
commands to convert to dB.

e. Plot the magnitude response (in dB) for all three filters on one plot and plot the phase
response for all three filters on another plot ( title the graph, label axes, and use a legend to
identity the filter )

Please include Matlab code. EVEN JUST PART A HELPS

Solutions

Expert Solution

Part a

MATLAB Code

clc;
clear all;
close all;

Wp = 0.45;
Ws = 0.5;
Rp = 0.5;
Rs = 60;

[N, Wn] = buttord(Wp, Ws, Rp, Rs);
[b, a] = butter(N, Wn);

fprintf('The order of the Butterworth filter to meet the given specifications is %d \n', N);

w = 0:pi/1000:pi;
H = freqz(b, a, w);

H_dB = 20*log10(abs(H));
H_phase = angle(H)*180/pi;


subplot(2,1,1)
plot(w/pi, H_dB, 'linewidth',2);
grid
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Magnitude in dB');
title('Magnitude Response of the Butterworth Filter');

subplot(2,1,2)
plot(w/pi, H_phase, 'linewidth',2);
grid
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Phase in degrees');
title('Phase Response of the Butterworth Filter');

After Execution, we get

In the command window, the order required is displayed

The order of the Butterworth filter to meet the given specifications is 51
>>

The frequency response plot obtained for the Butterworth Filter is as follows

Part b

MATLAB Code

clc;
clear all;
close all;

Wp = 0.45;
Ws = 0.5;
Rp = 0.5;
Rs = 60;

[N, Wn] = cheb1ord(Wp, Ws, Rp, Rs);
[b, a] = cheby1(N, Rp, Wp);

fprintf('The order of the Chebyshev Type I filter to meet the given specifications is %d \n', N);

w = 0:pi/1000:pi;
H = freqz(b, a, w);

H_dB = 20*log10(abs(H));
H_phase = angle(H)*180/pi;


subplot(2,1,1)
plot(w/pi, H_dB, 'linewidth',2);
grid
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Magnitude in dB');
title('Magnitude Response of the Chebyshev Type I Filter');

subplot(2,1,2)
plot(w/pi, H_phase, 'linewidth',2);
grid
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Phase in degrees');
title('Phase Response of the Chebyshev Type I Filter');

After Execution, we get

In the command window, the order required is displayed

The order of the Chebyshev Type I filter to meet the given specifications is 16
>>

The frequency response plot obtained for the Chebyshev Type I Filter is as follows

Part c

MATLAB Code

clc;
clear all;
close all;

Wp = 0.45;
Ws = 0.5;
Rp = 0.5;
Rs = 60;

[N, Wn] = ellipord(Wp, Ws, Rp, Rs);
[b, a] = ellip(N, Rp, Rs, Wp);

fprintf('The order of the Elliptic filter to meet the given specifications is %d \n', N);

w = 0:pi/1000:pi;
H = freqz(b, a, w);

H_dB = 20*log10(abs(H));
H_phase = angle(H)*180/pi;


subplot(2,1,1)
plot(w/pi, H_dB, 'linewidth',2);
grid
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Magnitude in dB');
title('Magnitude Response of the Elliptic Filter');

subplot(2,1,2)
plot(w/pi, H_phase, 'linewidth',2);
grid
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Phase in degrees');
title('Phase Response of the Elliptic Filter');

After Execution, we get

In the command window, the order required is displayed

The order of the Elliptic filter to meet the given specifications is 8
>>

The frequency response plot obtained for the Elliptic Filter is as follows

Part d

MATLAB Code

clc;
clear all;
close all;

Wp = 0.45;
Ws = 0.5;
Rp = 0.5;
Rs = 60;
w = 0:pi/1000:pi;


[Nb, Wn] = buttord(Wp, Ws, Rp, Rs);
[bb, ab] = butter(Nb, Wn);
Hb = freqz(bb, ab, w);


Nc = cheb1ord(Wp, Ws, Rp, Rs);
[bc, ac] = cheby1(Nc, Rp, Wp);
Hc = freqz(bc, ac, w);

Ne = ellipord(Wp, Ws, Rp, Rs);
[be, ae] = ellip(Ne, Rp, Rs, Wp);
He = freqz(be, ae, w);


wp_range = 0:pi/1000:0.45*pi;
ws_range = 0.5*pi:pi/1000:pi;

L1 = length(wp_range);
L2 = length(ws_range);

Hb_pb = Hb(1:L1);
Hb_pb_min = min(Hb_pb);
Rpb = 20*log10(abs(Hb_pb_min));

Hb_sb = Hb(L2:end);
Hb_sb_max = max(Hb_sb);
Rsb = 20*log10(abs(Hb_sb_max));

Hc_pb = Hc(1:L1);
Hc_pb_min = min(Hc_pb);
Rpc = 20*log10(abs(Hc_pb_min));

Hc_sb = Hc(L2:end);
Hc_sb_max = max(Hc_sb);
Rsc = 20*log10(abs(Hc_sb_max));


He_pb = He(1:L1);
He_pb_min = min(He_pb);
Rpe = 20*log10(abs(He_pb_min));

He_sb = He(L2:end);
He_sb_max = max(He_sb);
Rse = 20*log10(abs(He_sb_max));


fprintf('The order of the Butterworth filter to meet the given specifications is %d \n', Nb);
fprintf('The order of the Chebyshev Type I filter to meet the given specifications is %d \n', Nc);
fprintf('The order of the Elliptic filter to meet the given specifications is %d \n \n \n', Ne);


fprintf('The pass band ripple of the Butterworth filter designed is %f dB \n', Rpb);
fprintf('The stop band attenuation of the Butterworth filter designed is %f dB \n', Rsb);
fprintf('The pass band ripple of the Chebyshev Type I filter designed is %f dB \n', Rpc);
fprintf('The stop band attenuation of the Chebyshev Type I filter designed is %f dB \n', Rsc);
fprintf('The pass band ripple of the Elliptic filter designed is %f dB \n', Rpe);
fprintf('The stop band attenuation of the Elliptic filter designed is %f dB \n', Rse);

After executing, we get

The order of the Butterworth filter to meet the given specifications is 51
The order of the Chebyshev Type I filter to meet the given specifications is 16
The order of the Elliptic filter to meet the given specifications is 8


The pass band ripple of the Butterworth filter designed is -0.425802 dB
The stop band attenuation of the Butterworth filter designed is -60.000000 dB
The pass band ripple of the Chebyshev Type I filter designed is -0.500000 dB
The stop band attenuation of the Chebyshev Type I filter designed is -64.966806 dB
The pass band ripple of the Elliptic filter designed is -0.500000 dB
The stop band attenuation of the Elliptic filter designed is -60.000000 dB
>>

Part (e)

clc;
clear all;
close all;

Wp = 0.45;
Ws = 0.5;
Rp = 0.5;
Rs = 60;
w = 0:pi/1000:pi;


[Nb, Wn] = buttord(Wp, Ws, Rp, Rs);
[bb, ab] = butter(Nb, Wn);
Hb = freqz(bb, ab, w);
Hb_dB = 20*log10(abs(Hb));
Hb_phase = angle(Hb)*180/pi;


Nc = cheb1ord(Wp, Ws, Rp, Rs);
[bc, ac] = cheby1(Nc, Rp, Wp);
Hc = freqz(bc, ac, w);
Hc_dB = 20*log10(abs(Hc));
Hc_phase = angle(Hc)*180/pi;

Ne = ellipord(Wp, Ws, Rp, Rs);
[be, ae] = ellip(Ne, Rp, Rs, Wp);
He = freqz(be, ae, w);
He_dB = 20*log10(abs(He));
He_phase = angle(He)*180/pi;


plot(w/pi, Hb_dB, w/pi, Hc_dB, w/pi, He_dB, 'linewidth',2);
grid
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Magnitude in dB');
title('Magnitude Response of the Filters Designed');
legend('Magnitude Response of Butterworth Filter', 'Magnitude Response of Chebyshve Type - I Filter', 'Magnitude Response of Elliptic Filter', 'Location', 'SouthWest');

figure
plot(w/pi, Hb_phase, w/pi, Hc_phase, w/pi, He_phase, 'linewidth',2);
grid
xlabel('Normalized Frequency (\times \pi rad/sample)');
ylabel('Phase in degrees');
title('Phase Response of the Filters Designed');
legend('Phase Response of Butterworth Filter', 'Phase Response of Chebyshve Type - I Filter', 'Phase Response of Elliptic Filter', 'Location', 'SouthWest');

The plots obtained after execution


Related Solutions

Obtain the transfer function of a low pass digital filter meeting the following specifications: Passband 0...
Obtain the transfer function of a low pass digital filter meeting the following specifications: Passband 0 − 60 Hz; Stopband > 85 Hz; Stopband attenuation > 15 dB Assume sampling frequency of 256 Hz and having 3rd order Butterworth Characteristics.
Design a linear phase, minimum-length, band-pass FIR digital filter in MATLAB to meet the specifications listed...
Design a linear phase, minimum-length, band-pass FIR digital filter in MATLAB to meet the specifications listed below. Use Rectangular Windowing (MATLAB function: fir1) pass-band frequencies: f_p1 = 0.35, f_p2 = 0.65 stop-band frequencies: f_s1 = 0.10, f_s2 = 0.80 pass-band tolerance: d_p <= 0.1 stop-band tolerance: d_s <= 0.1 I am attempting to learn more about MATLAB and I am having trouble with specific filter design and it would be helpful to have an example.
Design a LP FIR filter to meet the following specifications using the window method. Use a...
Design a LP FIR filter to meet the following specifications using the window method. Use a Blackman window. Fs = 25 kHz Fc = 5.0 kHz (3 dB down) Attenuation = 80 dB at 7 kHz Give all the relevant plots (impulse, frequency responses) and the performance of the final filter. Compare this filter to one designed using the optimal method .
Design a LP FIR filter to meet the following specifications using the window method. Use a...
Design a LP FIR filter to meet the following specifications using the window method. Use a Blackman window. Fs = 25 kHz Fc = 5.0 kHz (3 dB down) Attenuation = 80 dB at 7 kHz Give all the relevant plots (impulse, frequency responses) and the performance of the final filter. Compare this filter to one designed using the optimal method. (Please use MATLAB to give all the answers)
1. Design a bandpass filter to meet the following specificatoins: lower stopband edge = 0.3π upper...
1. Design a bandpass filter to meet the following specificatoins: lower stopband edge = 0.3π upper stopband edge = 0.6π lower passband edge = 0.4π upper passband edge = 0.5π Rp = 0.5 dB, As = 50 dB Use a sampling frequency of 1000 Hz. You may use MATLAB and the fir1 commmand to implement. It is advisable to check the MathWorks site for help on using these commands. It is advisable to check if the commands use the ripple...
Design a comb filter in MATLAB that meets the following specifications: it eliminates 5 harmonics of...
Design a comb filter in MATLAB that meets the following specifications: it eliminates 5 harmonics of 100Hz it eliminates dc (zero frequency) |h(t)| <= 0.001 for t> 0.5
4)Design a band-pass filter with a passband from 500 Hz to 2000 Hz using “butter” routine...
4)Design a band-pass filter with a passband from 500 Hz to 2000 Hz using “butter” routine of MATLAB. Assume a sampling frequency of 8KHz. Let the filter order be M=4. Plot the magnitude response and provide the filter coefficients and the transfer function
Design a four-pole Chebychev bandpass filter which a passband of 4750 rads/sec to 5250 rad/s. The...
Design a four-pole Chebychev bandpass filter which a passband of 4750 rads/sec to 5250 rad/s. The pass band must have a magnitude between -0.5 and 0 db..
AMT, Inc., is considering the purchase of a digital camera for maintenance of design specifications by...
AMT, Inc., is considering the purchase of a digital camera for maintenance of design specifications by feeding digital pictures directly into an engineering workstation where computer-aided design files can be superimposed over the digital pictures. Differences between the two images can be noted, and corrections, as appropriate, can then be made by design engineers. a. You have been asked by management to determine the PW of the EVA of this equipment, assuming the following estimates: capital investment = $346,000; market...
AMT, Inc., is considering the purchase of a digital camera for maintenance of design specifications by...
AMT, Inc., is considering the purchase of a digital camera for maintenance of design specifications by feeding digital pictures directly into an engineering workstation where computer-aided design files can be superimposed over the digital pictures. Differences between the two images can be noted, and corrections, as appropriate, can then be made by design engineers. a. You have been asked by management to determine the PW of the EVA of this equipment, assuming the following estimates: capital investment = $346,000; market...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT