I am trying to solve a a 4-variable system of equations, however, I am getting the response:
Empty sym: 0-by-1
syms i1 i2 v1 v2
eqns = [-160 +10*i1+v1==0, 96==v2-12*i2,v2/v1==4, i1/i2 == 4 ];
s = solve(eqns,v1);
Any help would be much obliged.

 채택된 답변

darova
darova 2020년 5월 5일

0 개 추천

It's because of additional space
eqns = [-160 +10*i1+v1==0, 96==v2-12*i2,v2/v1==4, i1/i2 == 4 ];
size(eqns)
Try this solution
eqns = [-160+10*i1+v1==0, 96==v2-12*i2,v2/v1==4, i1/i2 == 4 ];

댓글 수: 3

I still am getting the s = Empty sym: 0-by-1
syms i1 i2 v1 v2
eqns = [-160+10*i1+v1==0, 96==v2-12*i2,v2/v1==4, i1/i2 == 4 ];
s = solve(eqns,v1);
display(s);
darova
darova 2020년 5월 5일
Try this
Preston Glenn
Preston Glenn 2020년 5월 5일
It worked thanks!

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2020년 5월 5일

0 개 추천

do not solve() a system of equations with multiple equations for a single variable. solve for as many variables as there are equations and select the appropriate output.
It does sometimes work to solve a system that includes inequalities if the number of equalities is the same as the number of variables being solved for.

댓글 수: 6

Preston Glenn
Preston Glenn 2020년 5월 5일
This worked as well. Thank you!
darova
darova 2020년 5월 5일
I did all the work myself. Why this question is accepted not mine?
Walter Roberson
Walter Roberson 2020년 5월 5일
darova, I provided a key solution and explanation before you provided the solution without explanation.
darova
darova 2020년 5월 5일
Your solution is incomplete
Preston Glenn
Preston Glenn 2020년 5월 5일
They were both good answers, and I appreciate the help. I didn't know who's to accept so, I kinda hit accept both, and exited before seeing which was accepted. Thinking about it, Darova responded multiple times to help, so I switched to theirs.
darova
darova 2020년 5월 5일
Thank you

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

카테고리

질문:

2020년 5월 5일

댓글:

2020년 5월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by