Numerical result for symbolic expression could not be obtained
1 次查看(过去 30 天)
显示 更早的评论
syms z T t s;
cz = (1-exp(-10*T)*z^(-1))/((2-exp(-10*T)*z^(-1))*(1-z^(-1)))
cs = subs(cz, z,exp(s*T))
ct = ilaplace(subs(cs,T,0.07),s,t)
y = eval(subs(ct,t,0.1))
stem(0.1,eval(y))
错误使用 stem
Unable to convert expression containing remaining symbolic function calls into double array. Argument must be expression that evaluates to number.
0 个评论
回答(1 个)
Yash
2023-11-21
Hello,
I understad that you are facing issues while using the "stem" function in MATLAB.
The "stem" function specifically works with numeric arguments, such as doubles, vectors, or matrices within certain restrictions, but it does not support symbolic expressions. You can find detailed information about the "stem" function in the MATLAB documentation available at the following link:
In your code, the error is likely caused by providing a symbolic expression as an argument to the "stem" function. The issue arises from the fact that the inverse Laplace of the expression "subs(cs,T,0.07)" in your code does not exist.
If "ilaplace" cannot compute the inverse transform, then it returns an unevaluated call to "ilaplace". For example:
syms F(s) t
F(s) = exp(s);
f(t) = ilaplace(F,s,t)
% Return the original expression using "laplace".
F(s) = laplace(f,t,s)
As the inverse laplace doesn't exist, "y" remains as a symbolic expression in the form of "ilaplace", and the "stem" function can not plot the points.
I hope this explanation helps to clarify the issue you are encountering.
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!