Designing butterworth filter of Nth order

In summary, the conversation discusses designing a digital butterworth lowpass filter of nth order with only the freedom of choice to the user being the order of the filter and the cut off frequency. The speaker has already implemented a first order lowpass filter and is now trying to extend their library to include a butterworth filter. They are seeking advice on how to incorporate the damping ratio as the order progresses and are considering different methods such as hard coding or finding zeros and poles based on the order of the filter. They mention a function called butter that can assist with this and are unsure of how to properly apply the cut off frequency. They also mention a function called lp2lp which specifies using rad/s for the cut off frequency.
  • #1
Xatax
1
0
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:
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:
% 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
 

Related to Designing butterworth filter of Nth order

1. What is a Butterworth filter?

A Butterworth filter is a type of electronic filter used in signal processing and circuit design. It is designed to have a flat frequency response in the passband and a gradual roll-off in the stopband.

2. How do I determine the order of a Butterworth filter?

The order of a Butterworth filter refers to the number of reactive components (inductors or capacitors) in the filter design. It is typically denoted as "N" and can range from 1 to infinity. The higher the order, the steeper the roll-off in the stopband. The order can be determined based on the desired cut-off frequency and the type of filter (low-pass, high-pass, band-pass, etc.).

3. What is the significance of the cut-off frequency in a Butterworth filter?

The cut-off frequency is the frequency at which the filter begins to attenuate the signal. In a Butterworth filter, the cut-off frequency is the point at which the signal is attenuated by 3 dB (half of its original amplitude). This is also known as the -3 dB point and is an important parameter in filter design.

4. How do I design a Butterworth filter of Nth order?

To design a Butterworth filter of Nth order, you will need to calculate the component values (resistors, capacitors, and inductors) based on the desired cut-off frequency and the filter's order. There are various online calculators and software programs available to assist with this process. Alternatively, you can use mathematical equations and tables to manually calculate the values.

5. What are the advantages of using a Butterworth filter?

Butterworth filters have a flat frequency response in the passband, which means they do not introduce any ripples or distortions to the signal. They also have a gradual roll-off in the stopband, making them suitable for applications that require a smooth transition between the passband and stopband. Additionally, Butterworth filters are easy to design and have a maximally flat response in the passband, making them ideal for use in audio and digital signal processing applications.

Similar threads

Replies
1
Views
699
Replies
8
Views
1K
  • Electrical Engineering
Replies
20
Views
2K
Replies
5
Views
1K
  • Electrical Engineering
Replies
3
Views
3K
Replies
14
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
2K
  • Electrical Engineering
Replies
29
Views
3K
Replies
20
Views
2K
Replies
7
Views
3K
Back
Top