Replacing symbolic subexpression with unspecified arguments
1 view (last 30 days)
Show older comments
Roman Frels
on 18 Mar 2022
Answered: Roman Frels
on 19 Mar 2022
Hello,
I would like to do a symbolic computation where I have to replace a subexpression with another.
However I can not use the subs instruction, since the parameters are changing:
syms a1 a2 a3 a4 x1 x2 x3 x4 y
y = sin(a1 * sin(x1))
%%Could be any ai and xi
Is there a way to replace the outer sin() with another symbolic function regardless of the parameters?
I'd assume that matlab uses an internal expression tree, but I don't think it's accessible.
0 Comments
Accepted Answer
Walter Roberson
on 18 Mar 2022
syms a1 a2 a3 a4 x1 x2 x3 x4 y
y = sin(a1 * sin(x1))
cos(children(y, 1))
0 Comments
More Answers (2)
Paul
on 18 Mar 2022
Not 100% clear on the question. Maybe this?
syms a1 a2 a3 a4 x1 x2 x3 x4
syms a x
y(a,x) = sin(a * sin(x))
y(a2,x2)
0 Comments
See Also
Categories
Find more on Assumptions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!