MATLAB Answers


how to subs more than one value in one equation

Asked by ali almarzooqi on 14 Oct 2019
Latest activity Answered by darova
on 14 Oct 2019
I want to replace more than one variable in one equation
syms x1 x2 x3;
x1 = (-50+x2+12*x3)/3;
x2 = 6*x1-x3-3;
x3 = 40-6*x1-9*x2;
z = subs(x1,0);
x1 = subs(z,0)
i want to do the last to steps in one step


Which variable should be replaced with zero here?
z = subs(x1,0);
I want to replace the two variable at the same time with zero

Sign in to comment.

1 Answer

Answer by darova
on 14 Oct 2019

Place variables in square brackets
syms x y z
eqn = x + 2*y + z;
eqn1 = subs(eqn,[x z],[0 0]) % new equation with replaced variables


Sign in to comment.