Clear Filters
Clear Filters

Designing a Butterworth Filter

22 views (last 30 days)
Oliver-Maximilian Klein
Oliver-Maximilian Klein on 18 Mar 2022
Hey there guys and gals,
i want to design a Butterworth filter for a field oriented control of a permanent magnet synchronous machine. Where a sensor in the rotor tracks the mechanical angle of the rotor. This signal is then differentiated. Because of the differentiation the high frequencies of the noise are amplified, so i need to filter it. Ive decided to model a 2nd order Filter. The motor is supposed to accelerate to n = 16000 rpm which is roughly an angular velocity omega of 1675 rad/min. So my cut off frequency is calculated based on fc = 1 / ( 2 *pi * omega (1675 / 60) ) ? And the pass frequency is everything below fc ?
If you need any clarifications, please let me know.
Thanks for your help in advance :)

Answers (1)

Scott MacKenzie
Scott MacKenzie on 19 Mar 2022
Edited: Scott MacKenzie on 19 Mar 2022
Here's a solution, but it requires MATLAB's Signal Processing Toolbox.
Given, sRate, the sample rate of your data, fc, the desired cuttoff frequency, and y1, your input signal, then...
% create 2nd-order low-pass butterworth filter
[b, a] = butter(2, fc/(sRate/2), 'low');
% filter the input signal (y1)
y2 = filter(b, a, y1);
  3 Comments
Scott MacKenzie
Scott MacKenzie on 20 Mar 2022
Edited: Scott MacKenzie on 20 Mar 2022
@Oliver-Maximilian Klein, you're welcome. BTW, what is the same rate of your data? And is your cutoff frequency simply the frequency of rotation of the motor, i.e., 16000/60 = 266.7 Hz?
Oliver-Maximilian Klein
Oliver-Maximilian Klein on 20 Mar 2022
my simulation runs in the continous time domain, so there is no rate of data. The cut off frequency should be 226.7 Hz. The angular acceleration is the torque divided by the inertia, and ive basically used that equation to compute a time constant for a first oder lag element low pass filter.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!