design a matlab program for an analog butterworth filter that has a 2db passband attenuation at a frequency of 20 radian/sec and atleast 10db stopband attenuation at 30 radian

15 views (last 30 days)
design a matlab program for an analog butterworth filter that has a 2db passband attenuation at a frequency of 20 radian/sec and atleast 10db stopband attenuation at 30 radian/sec

Answers (1)

Shubh Dhyani
Shubh Dhyani on 4 Aug 2023
Hi Navasakthi,
I understand that you want to create an analog butterworth filter with the given specifications.
You can design an analog Butterworth filter in MATLAB that meets the given specifications using the butter function, here’s the link for reference:
Here are the steps to do that:
1. Calculate the Order and Cut-off Frequency: Determine the required order and cut-off frequency for the Butterworth filter to meet the given specifications. You can use the "buttord" function for this:
2. Design the Filter: Using the order and cut-off frequency, you can design the filter using the "butter" function.
3. Plot the Frequency Response: To verify that the design meets the given specifications, you can plot the frequency response using the "freqs" function:
Here's the complete code:
% Specifications
passband_freq = 20; % 20 rad/sec
stopband_freq = 30; % 30 rad/sec
passband_attenuation = 2; % 2 dB
stopband_attenuation = 10; % 10 dB
% Convert specifications to values suitable for buttord
Wp = passband_freq;
Ws = stopband_freq;
Rp = passband_attenuation;
Rs = stopband_attenuation;
% Calculate the order and cut-off frequency for the Butterworth filter
[n, Wn] = buttord(Wp, Ws, Rp, Rs);
% Design the analog Butterworth filter
[b, a] = butter(n, Wn, 's');
% Plot the frequency response to verify the design
freqs(b, a);
title('Frequency Response of the Analog Butterworth Filter');
xlabel('Frequency (radians/second)');
ylabel('Amplitude (dB)');
grid on;
The function "buttord" calculates the minimum filter order required to meet the specifications.
The function "butter" designs the filter using the order and cut-off frequency.
The function "freqs" plots the frequency response, allowing you to visually verify that the filter meets the given specifications.
Note that the 's' argument in the butter function specifies that the filter should be an analog filter (as opposed to a digital filter).

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!