How to get z transfer function from difference equation?
23 次查看(过去 30 天)
显示 更早的评论
I have the difference equation
y(k) == (4*y(k - 1))/5 + (2*u(k))/5
and would like to get the transfer function
0.4*z
Gz(z)= -------
z-0.8
There are two issues. If I use vpa() to get
y(k) == 0.8*y(k - 1) + 0.4*u(k)
ztrans throws this error:
Error using symengine
The 'List' option is not allowed for input of this type.
Error in transform (line 74)
F = mupadmex('symobj::vectorizeSpecfunc', f.s, x.s, w.s, trans_func,
'infinity');
Error in sym/ztrans (line 28)
F = transform('ztrans', 'n', 'z', 'w', f, varargin{:});
Error in drt (line 31)
sys = ztrans(discrete_eqn,k,z)
but even if I don't use vpa(), ztrans(eqn,k,z) just gives the following output:
ztrans(y(k) == (4*y(k - 1))/5 + (2*u(k))/5, k, z)
Why doesn't it replace y(k-1) with 1/z*ztrans(y(k)) etc?
0 个评论
采纳的回答
Vidya Viswanathan
2015-12-22
The function "ztrans" returns the Z-transform of a symbolic expression/symbolic function with respect to the transformation index at a specified point. For example, the line of code
ztrans(f,trans_index,eval_point)
computes the Z-transform of f with respect to trans_index at point eval_point. For a given difference equation, say, y(n)=0.8y(n-1)+0.4u(n), the Z-transform can be computed as follows:
syms y(n) z;
eq=y(n)-0.8*y(n-1)-0.4*heaviside(n);
Zeq=ztrans(eq,n,z)
The output of the above is as follows:
Zeq =
ztrans(y(n), n, z) - 2/(5*(z - 1)) - (4*ztrans(y(n), n, z))/(5*z) - (4*y(-1))/5 - 1/5
In this case, the Z-transform of y(n-1) is correctly replaced by (1/z)*ztrans(y(n)).
Refer to the following link for more information about the computation of Z-Transforms using MATLAB:
0 个评论
更多回答(1 个)
Yash Sharma
2021-8-6
Zeq =
ztrans(y(n), n, z) - 2/(5*(z - 1)) - (4*ztrans(y(n), n, z))/(5*z) - (4*y(-1))/5 - 1/5
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!