Error using symbolic function inside a matlab functions
2 次查看(过去 30 天)
显示 更早的评论
Hi, i'm trying to make a function that calculate symbolic expression and after that it make a surface plot. Doing this:
syms r
alpha(r)=alpha0+pi/(tf)*(t-t0-(r-r0)/vr) %alpha0, tf, t, r0, vr are defined and constant
All work and no errors are given back.
Problems comes out when i wrote the same rows of code inside a matlab function, matlab gives back this error:
"Error using * (line xx) Invalid operand. Variables of type "sym" cannot be combined with other models."
I'm trying to run this code on server because of the quantity of calculation, on server the version of matlab installed is Matlab2018b, when i run the same files on local (matlab2021b) all work as well.
It is possible that from version 2018b to 2021 the methods to perform operations between "sym" and "double" objects are changed?
2 个评论
采纳的回答
Walter Roberson
2021-12-21
You are trying to use a symbolic function in combination with the Control System Toolbox. That is not possible.
In some cases, you can convert the symbolic function to a ratio of two polynomials and then extract the numerator and denominator and build transfer functions. Or sometimes you can convert to state-space representation.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!