Variable input argument for symbolic equations
조회 수: 4 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 8월 16일
"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
Walter Roberson
2018년 8월 21일
I do not recommend this to anyone except advanced users who have experience programming Maple or similar languages.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!