Substitute equation into another one

Hi,
I'm wondering whether there is a neat way to substitute an equation into another one.
Example:
1st equation: x*dx*dy+dy*dz*x+z
2nd equation: dx+dz=u
Expected solution: x*dy*u+z
How do I do that? Right now I wrote a script, which can do it (but its 70 lines long and quite slow). Is there an easy solution?
Thank you very much!
Product: Matlab 2012a

 채택된 답변

Argon
Argon 2012년 10월 31일

0 개 추천

Like that?
f = sym('x*dx*dy+dy*dz*x+z');
g = sym('dx+dz=u');
simplify(subs(f, 'dx', solve(g, 'dx')))
Of course, it gets harder if your equation is non-linear...

댓글 수: 1

Moritz
Moritz 2012년 10월 31일
So simple and so brilliant. Looks like I couldn't see the forest for the trees... Thanks a lot!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

질문:

2012년 10월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by