Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Designing butterworth filter of Nth order

Tags:
  1. Aug 9, 2016 #1
    I want to design a digital butterworth lowpass filter of nth order, with only freedom of choice to user being order of the filter and the cut off frequency, i already have a 1st order low pass.

    Code:​
    Code (C):
    T = 1/(2*pi*this.fc);
                this.A = -1/T;
                this.B = 1/T;
                this.C = 1;
                this.D = 0;



    This is a very basic lowpass PT1 filter, i take the state space matrix, descrtize it and apply it to my signal. now i want to extend my library to butterworth. I am trying to use as many minimal matlab commands as possible. So i thought it's better to derive in hand before implementing it. i wanted to know how to deal with damping ratio as the order is progressed.

    When i was searching for answer, i came across wiki of butter worth filter:
    Untitled.png

    I can just hard code this, but have they considered damping ratio and how do i covert this to state space.


    Or, i found another way, where i find zeros and poles based on the order of the filter.
    Code (C):
    % Poles are on the unit circle in the left-half plane.
    n = varargin{1} % order of the filter
    fc = varargin{2} % cut off frequency
    Wn = (fc*2)/Fs % Fs is sampling frequency, normalizing the cut off frequency
    z = [];
    p = exp(1i*(pi*(1:2:n-1)/(2*n) + pi/2)); %n is the order of the filter
    p = [p; conj(p)];
    k = real(prod(-p)); %product of an array element´

    %When we get zpk, we just convert them to state space.

    [a,b,c,d] = zp2ss(z,p,k);

    %Now transforming the abcd matrix to the given cut off frequency
    [a,b,c,d] = lp2lp(a,b,c,d,Wn);

    The only problem is while applying the cut off frequency, '[a,b,c,d] = lp2lp(a,b,c,d,Wn);' should apply normalized one or in rads/sec or just in Hz. Even though i tried all of them still would like i to ask where i am going wrong
     
  2. jcsd
  3. Aug 14, 2016 #2
    Thanks for the thread! This is an automated courtesy bump. Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post? The more details the better.
     
  4. Aug 18, 2016 #3

    donpacino

    User Avatar
    Gold Member

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Designing butterworth filter of Nth order
Loading...