How do rewrite a variable with the symbolic toolbox?

조회 수: 3 (최근 30일)
TG
TG 2019년 6월 4일
댓글: madhan ravi 2019년 6월 4일
Hi,
I have a question about the symbolic toolbox. When I use simple relations, I cannot rewrite a variable in another variable. here is an example:
syms a b
a=b+3
solve(a,b)
This leads however to -3, which means that solve assumes that a is 0? I would like an output like b=a-3. If I do this in another way using solve, solve cannot find a solution:
syms a b
a==b+3
solve(a,b)
Does anyone have an idea how I can find b=a-3? It isn't necessary to use solve, but I couldn't think of another way. Thanks in advance!

채택된 답변

madhan ravi
madhan ravi 2019년 6월 4일
syms a b
eq=a==b+3
isolate(eq,b)
%or
b=solve(eq,b)

추가 답변 (1개)

TG
TG 2019년 6월 4일
Do you maybe also know how I can fix this problem?
syms a b c
eq1= a==b+3;
eq2= c==2*b-3;
solve(eq2,eq1,a) % This doesn't work, gives an empty matrix
I would like to get an expression of c == 2*(a-3)-3, so I could then solve a in terms of c for example.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by