Replacing symbolic subexpression with unspecified arguments

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.

 채택된 답변

syms a1 a2 a3 a4 x1 x2 x3 x4 y
y = sin(a1 * sin(x1))
y = 
cos(children(y, 1))
ans = 

추가 답변 (2개)

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(a, x) = 
y(a2,x2)
ans = 
Roman Frels
Roman Frels 2022년 3월 19일

0 개 추천

Thank you for the answers!
Best regards

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

질문:

2022년 3월 18일

답변:

2022년 3월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by