Problems with Matlab Projects? You may face many Problems, but do not worry we are ready to solve your Problems. All you need to do is just leave your Comments. We will assure you that you will find a solution to your project along with future tips. On Request we will Mail you Matlab Codes for Registered Members of this site only, at free service...Follow Me.

Digital Filter Design

Digital Filter Design

Program to illustrate the design of a Butterworth bandstop filter.

% Program
% Design of a Butterworth Bandstop Digital Filter
Ws = [0.4 0.6]; Wp = [0.3 0.7]; Rp = 0.4; Rs = 50;
% Estimate the Filter Order
[N1, Wn1] = buttord(Wp, Ws, Rp, Rs);
% Design the Filter
[num,den] = butter(N1,Wn1,’stop’);
% Display the transfer function
disp(’Numerator coefficients are ’);disp(num);
disp(’Denominator coefficients are ’);disp(den);
% Compute the gain response
[g,w] = gain(num,den);
% Plot the gain response
plot(w/pi,g);grid
axis([0 1 -60 5]);
xlabel(’\omega /\pi’); ylabel(’Gain, dB’);
title(’Gain Response of a Butterworth Bandstop Filter’);

The order N of the FIR filter to meet the given specifications can be estimated using either Kaiser’s formula or Herrmann’s formula .The MATLAB function kaiord given below implements Kaiser’s formula:

function N = kaiord(Fp, Fs, dp, ds, FT)
% Computation of the length of a linear-phase
% FIR multiband filter using Kaiser’s formula
% dp is the passband ripple
% ds is the stopband ripple
% Fp is the passband edge in Hz
% Fs is the stopband edge in Hz
% FT is the sampling frequency in Hz.
% If none specified default value is 2
% N is the estimated FIR filter order
if nargin == 4,
FT = 2;
end
if length(Fp) > 1,
TBW = min(abs(Fp(1) - Fs(1)), abs(Fp(2) - Fs(2)));
else
TBW = abs(Fp - Fs);
end
num = -20*log10(sqrt(dp*ds)) - 13;
den = 14.6*TBW/FT;
N = ceil(num/den);

The function kaiserord in the Signal Processing Toolbox can also be used for estimating
the filter order using Kaiser’s formula. It can be used in one of the following forms:

[N, Wn, beta, ftype] = kaiserord(fedge, aval, dev)
[N, Wn, beta, ftype] = kaiserord(fedge, aval, dev, FT)
c = kaiserord(fedge, aval, dev, FT, ’cell’)

where FT is the sampling frequency in Hz whose default value is 2 Hz if not specified;
fedge is a vector of bandedge frequencies in Hz, in increasing order between 0 and FT/2;
and aval is a vector specifying the desired values of the magnitude response at the specified bandedges given by fedge

The MATLAB function firpmord implements the formula. It can be used in
one of the following forms:

[N,fts,mval,wgts] = firpmord(fedge,aval,dev)
[N,fts,mval,wgts] = firpmord(fedge,aval,dev,FT)

where FT is the sampling frequency in Hz whose default value is 2 Hz if not specified,
fedge is a vector of bandedge frequencies in Hz, in increasing order between 0 and FT/2;
and aval is a vector specifying the desired values of the magnitude response at the specified bandedges given by fedge. The length of fedge is 2 less than twice the length of aval and therefore must be even. dev is a vector of maximum deviations or ripples in dB allowable for each band

0 comments:

Post a Comment

Recent Comments

Popular Matlab Topics

Share your knowledge - help others

Crazy over Matlab Projects ? - Join Now - Follow Me

Sites U Missed to Visit ?

Related Posts Plugin for WordPress, Blogger...

Latest Articles

Special Search For Matlab Projects

MATLAB PROJECTS

counter

Bharadwaj. Powered by Blogger.