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.

Matlab FIR Design question

Status
Not open for further replies.

gnudaemon

Member level 1
Joined
Sep 16, 2004
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
338
matlab noscale why

Hi,
I need to design a bandpass filter in Matlab using Hamming windows
2 values minimum stopband attenuation As and maximum bandpass filter Rp are specified. But I don't know how to work with them in Matlab.
Any idea???

Added after 56 minutes:

Is there any relationship between filter order with As, Rp and (wp-ws)?
 

How about this?

N=64; h=fir1(N-1, [0.3,0.5], hamming(N)); freqz(h,1,512);

I think a Hamming window has fixed characteristics. If you change its ripple or attenuation, then it isn't a Hamming window anymore.
 

It's a normal routine but that doesn't change the ripple or attenuation. I just wonder how to control As and Rp values.
Btw, correct me if I'm wrong: I read from some where that the first parameter of fir1 should always be even, so the above formula is fir1(N, ..., hamming(N+1))
 

Hi gnudaemon

Try using fdatool in MATLAB. This is a GUI tool to design filters.
If you select a FIR filter and select window and then select hamming you see that you can only change the fc which is 6dB BW of the filter. To change stop band attenuation you should change the order.
These are the features if this filter type and can not be changed.
Because the response is maximally flat and passband ripple has no meaning.

Regards
 

use command
>>fdatool
a cool GUI tool for filter design
 

hi,
why don't you try a fir2 command you precise the frequency and their attenuations?
 

Using Kaiserord function. You can run this code.

fs = 8000; %Sampling Rate
f = [1000 1300 2210 2410]; %PassBand BandWidth
a = [0 1 0];
dev = [0.01 0.05 0.01];
[n,Wn,beta,ftype] = kaiserord(f,a,dev,fs);
n = n + rem(n,2);
b = fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');
[H,f] = freqz(b,1,1024,fs);
plot(f,abs(H))
grid on
xlabel('Frequency (Hz)')
ylabel('Magnitude Squared')
 

Hi,
Why should you use window? Many functions in Matlab can be used without considering window. You can use remez function and use remezord to estimate order of the filter based on the ripple in the passband and attenuation level in the stopband of your specification.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top