Numerical result for symbolic expression could not be obtained

1 Ansicht (letzte 30 Tage)
L siky
L siky am 16 Nov. 2023
Beantwortet: Yash am 21 Nov. 2023
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.

Antworten (1)

Yash
Yash am 21 Nov. 2023
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)
f(t) = 
% Return the original expression using "laplace".
F(s) = laplace(f,t,s)
F(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.

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!