MATLAB "solve" function not giving results and getting into infinite loop?
7 次查看(过去 30 天)
显示 更早的评论
I am using MATLAB's "solve" function to solve 4 equations for 4 unknowns. The equations are very complex but I am pretty sure that there is a solution for that system of equations. When I try to do that, MATLAB just gets stuck and not give any output. It is like MATLAB will be running forever.
My code basically looks like below:
PE = f(C1,C2,C3,C0);
%take derivatives of potential energy
dPE_C1 = diff(PE,C1,1);
dPE_C2 = diff(PE,C2,1);
dPE_C3 = diff(PE,C3,1);
dPE_C0 = diff(PE,C0,1);
%solve the systems of equations
Sbeam = solve(dPE_C1,dPE_C2,dPE_C3,dPE_C0,C1,C2,C3,C0);
Sbeam = [Sbeam.C1 Sbeam.C2 Sbeam.C3 Sbeam.C0];
c1 = Sbeam(1);
c2 = Sbeam(2);
c3 = Sbeam(3);
c0 = Sbeam(4);
I need to find the values of C1,C2,C3 and C0 but the MATLAB got stuck.
Have you ever experienced any problems like that? Do you have any suggestions how to solve it?
0 个评论
采纳的回答
Walter Roberson
2012-11-19
Even just solving four equations in four unknowns can take quite large amounts of memory. For example there was a recent post involving four equations that had ^2 in some of the terms; when I tried to solve on my system, I had to terminate it after it has gone through 6 gigabytes of memory. As soon as you get something that needs to work with explicit roots of a quartic, you are probably going to run out of memory (at least up to 8 Gb.)
3 个评论
Bram Delfos
2016-5-11
Hee Hugh,
I have exactly the same issue... Did you find a solution? Or is the only answer a better computer?
Cheers, Bram
Walter Roberson
2016-5-11
The solution is often to work iteratively, eliminating variables, taking one branch at a time and pursuing it. But sometimes there is just no practical approach to eliminate even the first variable when equations are sufficiently complex. For example the Three Body Problem does not involve many variables but there is no solution known.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!