Search code examples
matlabfrequencylowpass-filter

function that finds the cutoff frequency for low pass filter (in matlab)


I want to find the cutoff frequency for a lot of low pass filters. Therefor I want a function that can do that for me. I can make a Bode plot and find the frequency for -3dB, but that is boring and time-consuming. Does someone know how I can automatic this procedure? I was trying with

[mag,phase] = bode(sys) 

but failed. How should I go about this?

I have filter coefficients a,b available. I try to use some different technique when I discretize the transform function, therefore I want the cutoff frequency empirically from EKV:

y_k = b(1)*x_k + b(2)*x_{k-1} – a(2)*y_{k-1}

Solution

  • You can use the bandwidth command on LTI objects (transfer functions, etc.):

    G = tf(1, [1 1])
    bandwidth(G)
    
    ans =
    
        0.9976