manual continous to discrete conversion of low pass filter - wrong coefficients
1 view (last 30 days)
Show older comments
Hello.
It's my first contact with matlab and I stuck at some kind of problem.
I try to conver first order low pass filter H=W/(W+s) to discrete manually.
I know that resoult for Gud should be Gud = (0.3859*z)/(z - 0.6141) but i still get (0.0006279*z)/(z - 0.9994) and cut off frequency is at 10^-4 insted of 10^2
On the paper everything work well but I do not understand what do I miss at matlab.
Thanks for any advice.
PS. is it possible to rewrite this code to something simpler? As I mentioned it's my first script at matlab.
fco = 100;
fs = 1000;
dt = 1/fs;
W = 2*pi*fco; % analog
Wd = W*dt; % digital
z = tf('z');
s = tf('s');
% sUD = (z-1)/(dt*z);
sUD = (1-z^-1)/(dt);
% sUD = 2/1 * (z-1)/(z+1);
Gud = Wd/(sUD+Wd);
Gud = minreal(Gud)
G = W/(W+s);
% G2 = c2d(G,dt,'tustin');
b = bodeoptions;
b.YLim = {[-6,3];[-360,0]}; %{maglimits;phaselimits}
b.XLim = [10^-5,10^4];
b.YLimMode = {'manual';'auto'};
b.XLimMode = 'manual';
b.FreqUnits = 'Hz';
bode(G,Gud,b);
legend('continous','digital');
grid;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291263/image.png)
0 Comments
Answers (0)
See Also
Categories
Find more on Analog Filters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!