ztrans doesnt work with transfer function
5 views (last 30 days)
Show older comments
I am struggling with some tasks I was given. I have a continuous transfer function. and I have to calculate the dicrete transfer function using the Z transformation, ZOH method, and backward euler.
denominator = [(1/(w_n*w_n)), (2*zeta)/w_n, 1];
numerator = K;
% a)
Gs = tf(numerator, denominator);
Gz = tf(numerator, denominator, Ts);
G_dis = ztrans(Gs) % THIS DOESNT WORK
figure;
pzmap(Gz);
% b)
G_zoh = c2d(Gs, Ts);
figure;
pzmap(G_zoh);
This is what I have so far... the main problem I have is that ztrans(Gs) isnt working for me.... saying it cant work with tf input types. But that is the way I should be doing it in my lectures It says G(z) = Z{G(s)} . So I am a bit lost bc what I have only switches s for z and not z transform. whilst looking online I found that ztrans takes in ztrans(f) f being a function or symbolic expression to be transformed so why doesnt it work with transfer functions?
I need help on how to use z transform on transfer functions.
0 Comments
Accepted Answer
Star Strider
on 5 Nov 2019
The ztrans function is part of the Symbolic Math Toolbox. You are mixing Control System Toolbox and Symbolic Math Toolbox objects in your code, so you need to use the appropriate conversion functions to make them compatible.
Try this:
syms t z
K = 10;
w_n = 0.42;
zeta = 0.5;
Ts = 0.01;
denominator = [(1/(w_n*w_n)), (2*zeta)/w_n, 1]; % Define As A Numeric Vector
numerator = K; % Define As A Numeric Scalar
% a)
Gs = tf(numerator, denominator);
Gz = tf(numerator, denominator, Ts);
G_dis = ztrans(poly2sym(Gs.Numerator{:})) % Use Appropriate Functions To Convert To Symbolic Object
figure;
pzmap(Gz);
% b)
G_zoh = c2d(Gs, Ts);
figure;
pzmap(G_zoh);
producing:
G_dis =
(10*z)/(z - 1)
and the plots.
Experiment to get different results.
2 Comments
Star Strider
on 5 Nov 2019
As always, my pleasure!
I doubt any MATLAB built-in function would do a backward euler discretization. You would likely have to write that code.
More Answers (0)
See Also
Categories
Find more on Calculus 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!