Error using symbolic function inside a matlab functions
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lorenzo Lunghini
am 21 Dez. 2021
Kommentiert: Lorenzo Lunghini
am 21 Dez. 2021
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 21 Dez. 2021
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.
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!