필터 지우기
필터 지우기

why am I getting the error "Incorrect number or types of inputs or outputs for function 'solve'."

조회 수: 199 (최근 30일)
my code is;
syms d;
s=solve('7*d + 3*e=71','d + 2*e=20');
s=[s.d s.e];
disp('1 dollar = ');
s(1)
disp('Eullar');
I am getting the error:
Incorrect number or types of inputs or outputs for function 'solve'.
Error in HW10 (line 2)
s=solve('7*d + 3*e=71','d + 2*e=20');
The qustion I am solving is:
"Seven dollars and 3 Euros make 71 Eullars.
One dollar and 2 Euros make 20 Eullars.
find out the value of a dollar in terms of Eullars"

채택된 답변

Star Strider
Star Strider 2023년 3월 23일
For equality inside a symbolic expression, use double equal signs (==) —
syms d e
s=solve(7*d + 3*e == 71,d + 2*e == 20);
s=[s.d s.e];
disp('1 dollar = ');
1 dollar =
vpa(s(1),3)
ans = 
7.45
disp('Eullar');
Eullar
The ability to use character arrays has been removed (depricated). Although ‘e’ was not included in the syms call, I assume it is a variable and not the exponential function e that is the exp function. If it should be ‘exp(1)’ (or the exponential function of some other argument), make the appropriate changes in your code.
.
  댓글 수: 2
Harshit
Harshit 2023년 10월 12일
i have the same problem my code is like this:
syms a b
>> exp_1='a*x+b*y-3';
>> exp_2='-x+2*a*y-5';
>> [x,y]=solve(exp_1,exp_2)
after this step it shows the same error
Star Strider
Star Strider 2023년 10월 12일
syms a b x y
exp_1=a*x+b*y-3;
exp_2=-x+2*a*y-5;
[x,y]=solve(exp_1,exp_2)

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

추가 답변 (0개)

카테고리

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

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by