help --- symbolic expression or function

조회 수: 3 (최근 30일)
justlikethat
justlikethat 2021년 6월 11일
댓글: justlikethat 2021년 6월 11일
I've created a code for the symbol variables.
But I'm very embarrassed because the same error keeps coming out.
I'd appreciate it if you could tell me the solution.
syms x y z
one = sym('3*x +2*y - z = 10');
two = sym('-x + 3*y + 2*z = 5');
three = sym('x -y - z = -1');
[x,y,z] = solve(one,two,three)
error messeage ---->
The text vector and string type of the first argument can only specify variables or numbers. Use 'str2sym' to evaluate the string type and the text vector representing the symbol expression.
Error occurred: sym>tomupad (Line 1296)
S = convertChar(x);
Error occurred: sym (Line 234)
S.s = tomupad(x);
Error occurred: symsolve (Line 2)
one = sym('3*x +2*y - z == 10');
My grammar may be wrong because I am not good at English. Thank you!

채택된 답변

Walter Roberson
Walter Roberson 2021년 6월 11일
The code you are using has not been valid since about R2017b.
syms x y z
one = str2sym('3*x +2*y - z = 10');
two = str2sym('-x + 3*y + 2*z = 5');
three = str2sym('x -y - z = -1');
[x,y,z] = solve(one,two,three)
x = 
y = 
5
z = 
but better would be
syms x y z
one = 3*x +2*y - z == 10;
two = -x + 3*y + 2*z == 5;
three = x -y - z == -1;
[x,y,z] = solve(one,two,three)
x = 
y = 
5
z = 
  댓글 수: 1
justlikethat
justlikethat 2021년 6월 11일
Thank you so much!
Looks like the data I saw was out of date.

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

추가 답변 (1개)

KSSV
KSSV 2021년 6월 11일
syms x y z
one = 3*x +2*y - z == 10;
two = -x + 3*y + 2*z == 5;
three = x -y - z == -1 ;
s = solve({one,two,three},x,y,z) ;
[s.x s.y s.z]
  댓글 수: 1
justlikethat
justlikethat 2021년 6월 11일
Thank you so much!
Looks like the data I saw was out of date.

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

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by