Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

iir filter design in matlab

Status
Not open for further replies.

lakshmikalyani

Member level 1
Member level 1
Joined
Jan 5, 2014
Messages
36
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Location
kakinada
Activity points
248
hi
i had written a code in matlab for a iir filter with following specs
wp=[200 315] and sampling frequency 16600
but i need to deside the other specs i.e. stopband freqyencies and ripple and attenuations
but the filter characteristics are not producing due to high sampling frequencies.
the sampling frequency must be high because this is a bank of filters with range of 200 to 7500
please help me to get the filter characteristics
 

but the filter characteristics are not producing due to high sampling frequencies
I don't understand what you exactly mean with this statement.

An IIR filter with nomalized passband corner frequencies [0.012 0.019] can be made. You get of course a high dynamic range for the filter cofficients, resulting in respectively high word length of a fixed point implementation. I presume the Matlab filter design functions will just calculate the parameters. So what's your problem?
 

I don't understand what you exactly mean with this statement.

An IIR filter with nomalized passband corner frequencies [0.012 0.019] can be made. You get of course a high dynamic range for the filter cofficients, resulting in respectively high word length of a fixed point implementation. I presume the Matlab filter design functions will just calculate the parameters. So what's your problem?

Code:
close all; clear all; clc;
 
% Generate input signal
fsamp = 16600; % (Hz)
dt = 1/fsamp; % (secs)
t = 0:dt:0.2;
fsine1 = 100; % (in passband: should remain in filter output)
a=10;
% am=20*log(a);
%fsine2 = 450; % (in stopband: should be removed by filter)
in = a*sin(2*pi*fsine1*t); 
%+ 10*sin(2*pi*fsine2*t);
 
% Plot input signal
figure(1);
plot(t, in);
title('Input');
xlabel('Time (secs)');
ylabel('Amplitude');
grid on;
 
% Design filter
wp = [200 315]; % Passband corner frequency
ws = [180 346.5]; % Stopband corner frequency
rp = 1;   % Passband ripple (dB)
rs = 80;  % Stopband attenuation (dB)
w1 = 2*wp/fsamp;
w2 = 2*ws/fsamp;
[N,wn] = ellipord(w1,w2,rp,rs)
[b,a] = ellip(N,rp,rs,wn);
 
% Plot filter frequency response
[H,W] = freqz(b,a,fsamp);
mag = 20*log(abs(H));
figure(2);
plot(fsamp*W/(2*pi), mag);
title('Frequency Response');
xlabel('Frequency (Hz)');
ylabel('(dB)');
axis tight;
grid on;
 
% Apply filter and plot output
out = filter(b, a,in);
figure(3);
plot(t, out);
xlabel('Time (secs)');
ylabel('Amplitude');
grid on;
just see the response of the code we are not getting the filter characteristics due to high sampling frequency
i don understand what is the relation with sampling frequencies
and i want to know what are the limitations of normalized frequencies if any exists
 

I see the problem.

It's nature (numerical instabilities with [a,b] filter description) and possible solutions (use [z,p,k] description) are discussed in the Matlab online help under ellip function limitations.
 
how to filter the input with sos and g
since we cant give the input to the filter without filter coefficients
 

how to filter the input with sos and g
since we cant give the input to the filter without filter coefficients

You need to read a little bit in the matlab help sections for this information.

sos format means second order sections. So for example, if you are exporting the sos parameters from fdatool, it gives an sos matrix where each line corresponds to a set of 2nd order filter coefficients.

You can implement this as a cascade of second order sections, or you can use sos2tf to convert to an overall transfer function. And then use the filter function to find the output. Also see sosfilt for finding output straight from sos matrix.

Your filter requirements are quite stringent. You should definitely be looking at the necessary dynamic range (word length) and the sensitivity of coefficients. Cascading second order sections to realize your filter reduces this sensitivity.

See matlab help section in signal processing toolbox >> analog and digital filters >> digital filter implementation.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top