Solve returns empty result although solution exists

Hello I'm trying to solve the following system of equations,
This should be easy to solve by hand. However using solve returns an empty sym struct. what am i missing here?
variables used are attached.
Thank you.
EDIT: re-uploaded variables and added code.
EDIT2:provided working example as per @Walter Roberson's comment.

댓글 수: 5

Torsten
Torsten 2019년 3월 19일
편집: Torsten 2019년 3월 19일
But as far as I can see, there is nothing in your equations that must be treated symbolically.
Just use "\" to solve the linear system in p_ij.
Your .mat file fails. It is impossible to read its contents.
Post or attach your code as a text .m file, and attach your data in a readable form (.txt, .mat, or something else).
Is it possible that you have Maple installed on your system?
yes I installed Maple specifically to see if it produces different outcome.
same problem occurred.
Hazem Abdelghany
Hazem Abdelghany 2019년 3월 19일
편집: Hazem Abdelghany 2019년 3월 19일
@Torsten do you mean linsolve()?

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

 채택된 답변

Walter Roberson
Walter Roberson 2019년 3월 19일

0 개 추천

You are accidentally using Maple's sym() and solve() calls. The .mat you provided for us is only useable by people who have installed "MATLAB Connector for Maple" .
You need to use pathtool to give the Maple functions a lower priority than the MATLAB functions and recreate the equations matrix and try again.

댓글 수: 5

Did as you said, you should be able to reproduce the error using Matlab's default symbolic toolbox now.
Thanks.
You have 15 equations in 14 variables and your system is inconsistent.
Part of the reason for inconsistency is your use of floating point numbers.
[A,b] = equationsToMatrix(eqns);
sol = A(1:14,:)\b(1:14);
A*sol-b
The final inconsistent row will be about 1E-13. A single bad round-off in your floating point values could lead to that.
wow, thanks, finally some hope.
s there a way I can solve this? maybe some tolerance parameter?
i
Walter Roberson
Walter Roberson 2019년 3월 19일
편집: Walter Roberson 2019년 3월 21일
The lines above show a solution in which the only inconsistency is on the order of 1E-13 , The order of the variables in sol will be the same as symvar(eqns)
Note: if you vpa(eqn) and compare that to your posted equations, you will see that they do not round exactly the same way. The equations in your .mat are not exactly the same as you would get by converting your posted equations to rationals. That matters because the correction you would need to make the equations consistent is less than the difference in stored versus posted values -- whatever round-off you have going in creating those coefficients is causing problems.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

Community Treasure Hunt

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

Start Hunting!

Translated by