Originally Posted by

**meddi83** 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'.

Regards

The return value f contains the frequency scale. If the pass band is 0 to 0.19 then and the stop band 0.28 to 1:

Code:

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

CB