nth order filter approximations to LPF not giving proper results

2 views (last 30 days)
Hi , i am trying to implement an analog filter Butterworth Low pass filter and want to observe the effect of order over the magnitude of that filter I have tried using the inbuilt 'butter(n,Wn,ftype)' filter but want to implement the same using the base algoritm without any inbuilt function .I have tried but not getting the proper results .
The input parameters are as follows:
Wc=pi/2.
w=(0,4*Pi) at 8pi/1000 intervals .
Thanks in advance .

Accepted Answer

Harsh Kumar
Harsh Kumar on 27 Jun 2023
Hi Bhaskar,
I understand that you are trying to implement an analog butterworth filter with the given specifications programmatically instead of using MATLAB in-built ‘butterfunction .
You can use the fundamental mathematical strategy to implement it in MATLAB as well.
Please refer to the below code snippet for better understanding.
%frequency over which you are iterating
w=0:8*pi/1000:4*pi;
%cutt-off frequency
wc=pi/2;
%pre-setting to zero
H_w_2=zeros(1,length(w));
%checking for multiple orders(optional)
for N=1:5:11
num=1;
den=zeros(1,2*N);
den(1)=1;
for i=1:1:length(w)
%implement the equation of butterworth filter
H_w_2(i)=1/(1+power(w(i)/wc,2*N));
end
plot(w,abs(H_w_2));
hold on
end
legend('N=1','N=6','N=11')

More Answers (0)

Community Treasure Hunt

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

Start Hunting!