I want to design a FIR filter by using 'cfirpm' function , which can i use the group delay and grid frequency, my code is :

N=30 ;

But i got the following error in matlab,

Error using cfirpm
Band edges must be monotonically increasing. 

How can i solve this problem? or,how can i add the group delay in this function?

Thank you in advance.


For a low-pass filter it is sufficient to specify the band edges, as shown in this example on the mathworks website. From your code I suppose that your band edges are


Note that you wrote -0.7 and -0.8 (i.e., with a negative sign), which I assume is a mistake.

Furthermore, think about the desired phase or group delay response. The phase factor exp(-j*pi*f*N-1/2) does not make much sense, an it is probably not what you mean. If you want a linear phase (with delay $N/2$, where $N$ is the filter order) there is no need to use cfirpm, and you could better use firpm.

  • $\begingroup$ Using Wolfram over the free web interface I get the "Standard computation time exceeded..." error with the following "int (r^2-x^2)^(3/2), x=-r to r" ... ? quite strange? $\endgroup$
    – Fat32
    Aug 7 '18 at 21:59
  • $\begingroup$ @Fat32: Somehow I get the feeling that this comment doesn't belong here ... $\endgroup$
    – Matt L.
    Aug 7 '18 at 22:03
  • $\begingroup$ As far as I remember, from time to time, you suggest using Wolfram alfa for symbollic expression evaluations (especially for integrals and sums) . So I felt that I should immediately ask it to you, after getting this weird time-out response? So I wondered if u also get that error. btw I know this is not the place :-) $\endgroup$
    – Fat32
    Aug 7 '18 at 22:06
  • $\begingroup$ @Fat32: OK, I thought it would refer to some other answer ... and, no, I have no idea what's going on; sometimes it does time-out on me too, sometimes it even gives me a wrong result (unless I'm mistaken ...) $\endgroup$
    – Matt L.
    Aug 7 '18 at 22:12
  • $\begingroup$ @Fat32: And if I'm not missing anything, it doesn't look like the most straightforward integral anyway. $\endgroup$
    – Matt L.
    Aug 7 '18 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.