symbolic substitution symbol by symbol
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi
I was trying to replace symbol by symbol with the code:
syms u v x y
N=u+3*v;
u=2*x;
v=2*y;
N=subs(N,[u,v],[2*x,2*y]);
The result I got :
N =
u + 3*v
where is my mistake?
댓글 수: 0
답변 (1개)
Martin Schätz
2015년 10월 15일
You should not define the u=2*x; v=2*y; because then you get right anwer from subs. It wil simplify the answer and it will be true. Try to run this:
clear all, close all, clc
syms u v x y
N=u+3*v;
N=subs(N,[u v],[2*x 2*y])
and then this:
clear all, close all, clc
syms u v x y
u=2*x; v=2*y;
N=u+3*v
You will get right answer both times.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!