3 Equations with 3 unknowns - 0-by-1 error

3 次查看(过去 30 天)
Hi I am trying to find the 3 unknowns in the 3 equations below, but keep getting the "Empty sym:0-by-1" error in Matlab, can anyone please assist. Below is my code containing the 3 equations with 3 unknowns: m,n and c:
Pr=0.9
Re_1=524547.1308
Re_2=380623.7002
Re_3=257100.895
Nu_1=262.7267636
Nu_2=201.8318306
Nu_3=157.0659409
Nu_4=89.64739312
syms m n c
eqn1= c*Re_1.^m*Pr.^n == Nu_1;
eqn2= c*Re_2.^m*Pr.^n == Nu_2;
eqn3= c*Re_3.^m*Pr.^n == Nu_3;
sol= solve(eqn1,eqn2,eqn3,m,n,c)
mSol=sol.m
nSol=sol.n
cSol = sol.c

回答(1 个)

John D'Errico
John D'Errico 2017-10-2
编辑:John D'Errico 2017-10-2
It is not an error. It is a fact of life.
It is trivial to formulate equations or systems of equations that have no analytical solution, or at least no solution that could be found. In fact, you did just that.
It always helps to apply common sense. Exactly why was no solution found? What happens if you log each of those equations? Nothing changes in theory. If a solution existed before, it will still exist.
eqn1 = log(c) + m*log(Re_1) + n*log(Pr) == log(Nu_1);
eqn2 = log(c) + m*log(Re_2) + n*log(Pr) == log(Nu_2);
eqn3 = log(c) + m*log(Re_3) + n*log(Pr) == log(Nu_3);
Look carefully at the problem. We have a constant term, in the form of log(c). We have n times a constant, the same constant in each equation, thus log(Pr).
Effectively you have a rank 2 system of 3 linear equations, in 3 unknowns. This system will almost always NEVER have a solution. This is not the case where infinitely many solutions exist. It is the case where no solution exists at all.
What did MATLAB tell you? It returned an empty array for the solutions. So, as I predicted, NO solution exists. Period. Wanting magic to happen is not sufficient.

类别

Help CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by