필터 지우기
필터 지우기

how insert values of constants after using "solve" command

조회 수: 1 (최근 30일)
tomer polsky
tomer polsky 2017년 10월 31일
댓글: tomer polsky 2017년 10월 31일
hello lets say i have this code :
syms x y c
X=[x ;y]
A=[3 -9; c 4]
B=[-42 ;2 ]
eqn=B==A*X
S=solve(eqn, x,y)
x=S.x
y=S.y
and I get answer of x and y , then lets say that I want C=3 and insert it to to x and get numerical answer , how do I make it happen ?

채택된 답변

Birdman
Birdman 2017년 10월 31일
  댓글 수: 4
Walter Roberson
Walter Roberson 2017년 10월 31일
Using the cell arrays as cvklpstunc shows is the more robust way, needed when vectors or arrays are being substituted for variables. But in the case of scalars, you can also use, for example,
eq = subs(eq, [a, b, c, d, e], [1, 2, 3, 4, 5])
with [] instead of {}. There are times when this is easier to use
tomer polsky
tomer polsky 2017년 10월 31일
ok thank you for your help

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by