Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

GIVE THE MATLAB CODE FOR THIS USING THE BELOW SYNTAX Design a lowpass digital filter using a Butterworth prototype to satisfy: W p = 0.2?

GIVE THE MATLAB CODE FOR THIS USING THE BELOW SYNTAX

Design a lowpass digital filter using a Butterworth prototype to satisfy:

Wp= 0.2? Rp= 1dB

Ws= 0.3? As= 15dB

function [b,a] = afd_butt(Wp,Ws,Rp,As); % Analog Lowpass Filter Design: Butterworth % ----------------------------------------- % [b,a] = afd_butt(Wp,Ws,Rp,As); % b = Numerator coefficients of Ha(s) % a = Denominator coefficients of Ha(s) % Wp = Passband edge frequency in rad/sec; Wp > 0 % Ws = Stopband edge frequency in rad/sec; Ws > Wp > 0 % Rp = Passband ripple in +dB; (Rp > 0) % As = Stopband attenuation in +dB; (As > 0) % if Wp <= 0 error('Passband edge must be larger than 0') end if Ws <= Wp error('Stopband edge must be larger than Passband edge') end if (Rp <= 0) | (As < 0) error('PB ripple and/or SB attenuation ust be larger than 0') end N = ceil((log10((10^(Rp/10)-1)/(10^(As/10)-1)))/(2*log10(Wp/Ws))); fprintf(' *** Butterworth Filter Order = %2.0f ',N) OmegaC = Wp/((10^(Rp/10)-1)^(1/(2*N))); [b,a]=u_buttap(N,OmegaC);

function [db,mag,pha,grd,w] = freqz_m(b,a); % Modified version of freqz subroutine % ------------------------------------ % [db,mag,pha,grd,w] = freqz_m(b,a); % db = Relative magnitude in dB computed over 0 to pi radians % mag = absolute magnitude computed over 0 to pi radians % pha = Phase response in radians over 0 to pi radians % grd = Group delay over 0 to pi radians % w = 501 frequency samples between 0 to pi radians % b = numerator polynomial of H(z) (for FIR: b=h) % a = denominator polynomial of H(z) (for FIR: a=[1]) % [H,w] = freqz(b,a,1000,'whole'); H = (H(1:1:501))'; w = (w(1:1:501))'; mag = abs(H); db = 20*log10((mag+eps)/max(mag)); pha = angle(H); % pha = unwrap(angle(H)); grd = grpdelay(b,a,w); % grd = diff(pha); % grd = [grd(1) grd]; % grd = [0 grd(1:1:500); grd; grd(2:1:501) 0]; % grd = median(grd)*500/pi;

function [b,a] = imp_invr(c,d,T) % Impulse Invariance Transformation from Analog to Digital Filter % --------------------------------------------------------------- % [b,a] = imp_invr(c,d,T) % b = Numerator polynomial in z^(-1) of the digital filter % a = Denominator polynomial in z^(-1) of the digital filter % c = Numerator polynomial in s of the analog filter % d = Denominator polynomial in s of the analog filter % T = Sampling (transformation) parameter % [R,p,k] = residue(c,d); p = exp(p*T); [b,a] = residuez(R,p,k); b = real(b'); a = real(a');

function [b,a] = u_buttap(N,Omegac); % Unnormalized Butterworth Analog Lowpass Filter Prototype % -------------------------------------------------------- % [b,a] = u_buttap(N,Omegac); % b = numerator polynomial coefficients of Ha(s) % a = denominator polynomial coefficients of Ha(s) % N = Order of the Butterworth Filter % Omegac = Cutoff frequency in radians/sec % [z,p,k] = buttap(N); p = p*Omegac; k = k*Omegac^N; B = real(poly(z)); b0 = k; b = k*B; a = real(poly(p));

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

To find integral of sin(logx) .

Answered: 1 week ago