ztrans doesnt work with transfer function

조회 수: 6 (최근 30일)
Josip Juros
Josip Juros 2019년 11월 5일
댓글: Star Strider 2019년 11월 5일
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.

채택된 답변

Star Strider
Star Strider 2019년 11월 5일
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
Josip Juros
Josip Juros 2019년 11월 5일
Yes, Thank you I used c2d iwht the methods I needed. I found that those two toolboxes are compatable. Thank you. Is there a way to do a backward euler discretization? or do I have to do it manually on paper bc I cant find anything for that....
Star Strider
Star Strider 2019년 11월 5일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by