I have just got a very simple question regarding maximum passband and stopband ripple in matlab.
suppose I have the following filter frequency plots:
Imageshack - filter2c.jpg
Imageshack - filter1g.jpg
What are the maximum passband/stopband ripple of each filter ? And how do you find them?
Thanks a lot
First of all thank you for your reply and help CB.
So I suppose 'maximum stopband ripple' refers to the maximum value of the stopband, right? Same with passband respectively?
So if I assume the above, the maximum passband ripple is 0 db, right?
About the phase, I have no idea..
But I can tell you how the filters are designed if that helps
Basically they are fir1 filters:
fil1 = fir1(100,[0.19 0.28]);
fil2 = fir1(100,0.01);
I was told that, given the freq response H(w) of a filter, in order to find the ripple response, I do the following subtraction:
H(w) - D(w) where D(w) is the desirable response.
For the maximum passband ripple we have to find the maximum absolute value in the passband and for for the maximum stopband ripple find the absolute maximum absolute value in the stopband.
The thing is, I do have the H(w) (for example say I use H = freqz(fir1(100,0.01)) ), What is the desirable D(w) ? ?
Thank you for your reply, CB.
Unfortunately I have never done signals and this kind of stuff in my life before and I don't understand much from these stuff.
The main aim of the project is to record 10 training patters for 10 classes (done this).
Then pass them through 20 fir1 filters - using convolution - and evaluate the output of the filter at the time index 0. (The filters have length 100, transition band bandwidth is 0.002pi (Δ=0.001pi) and the first 10 are uniformly distributed between [0, pi/10] and the other 10 between [pi/10, pi]. (done this too)
Basically I finished the matlab programming, I get the results etc, but I am asked to plot the frequency responses of all the filters (i did using freqz(filter) ) and then list the maximum passband/stopband ripples of these filters.
Is any of the information provided useful on how to find the maximum passband/stopband ripples?
Sorry for all my stupid questions but I am totally new to this stuff.
Compute for in the pass band and for in the stop band/s.
You might have found this easier if you had used the Parks-McLelland design tool for equiripple FIR's where the ripple levels are among the design parameters.
CB, Thank you again for your reply.
Suppose I have the following filter: h = fir1(100, [0.19 0.28]) - vector of size 1x101
I use [Hw,f] = freqz(h) . This return me a vector 'Hw' of Frequency responses of length 512x1 and 'f' a vector of the corresponding frequencies of length agai 512x1.
I suppose what you meant is, for the maximum passband ripple, find max(||Hw|-1|) and for maximum stopband ripple max(|Hw|) . How do I find out which of the 512 points of Hw belong to passband and which belong to stopband ?
P.S. I tried using both max functions on whole Hw and they both return '1'.
CBCode:idx=find((f<0.19)&&(f>0)) %gives the indices of the f array %corresponding to the pass band xx=abs(abs(Hw(idx))-1) %pass band ripple idx=find((f>0.28)&&(f<max(f))) %gives the indices of the f array %corresponding to the stop band yy=abs(Hw(idx)) %stop band ripple
Oh now I get it; thank you CB!
By the way the find commands return me an error:
??? Operands to the || and && operators must be convertible to logical scalar values.
(though using just one logical function works; seems like && causes an error).
Any idea how to fix this?