Variable input argument for symbolic equations
Ältere Kommentare anzeigen
Hello! I have a set of symbolic equations with a function receiving variable number of inputs in each equation. Is there a way to define symbolic function which has variable input arguments? The equations look something like this:
1. var1 == myFun(3,4)
2. var2 == myFun(9,3,2)
3. var3 == myFun(5,8,1,80,4)
ps: I know varargin can be used for normal functions and although quite stupid, I still tried my luck using it for the symbolic function. And as expected, it didn't work.
Antworten (1)
Walter Roberson
am 16 Aug. 2018
"Is there a way to define symbolic function which has variable input arguments?"
Yes. You can use
evalin(symengine, 'MUPAD FUNCTION DEFINITION GOES HERE')
However, you can only display the function by using evalin(symengine) or feval(symengine): if you attempt to display the function at the MATLAB level, then you will get a corrupted symbolic computation session.
Notice this is not a MATLAB function you put in quotes, and not a symbolic expression: it would have to be in the MuPAD programming language. See example 13 and https://www.mathworks.com/help/symbolic/mupad_ref/args.html
2 Kommentare
Tiasa Ghosh
am 21 Aug. 2018
Walter Roberson
am 21 Aug. 2018
I do not recommend this to anyone except advanced users who have experience programming Maple or similar languages.
Kategorien
Mehr zu Common Operations finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!