Simultaneous Nonlinear Equations - Using fsolve - Specific Example (Troubleshoot)
Show older comments
Hi All,
I'm working on a simple function to solve a pair of nonlinear equations simultaneously using fsolve.
At the moment, I'm working on a specific example as a precursor to a more complex approach. Unfortunately, I seem to be having trouble getting the correct answer from my code. To save an aneurysm, I thought I'd ask for a troubleshoot.
The equations come from the Streeter-Phelps Model and are for the Critical Time & Critical Deficit. The equations are in the attached file in their original format.
My current Function looks like this:
function F=StreeterPhelps(k)
Kr=k(1);
Kd=k(2);
F(1)=((1/0.2775-Kr)*log(0.2775/Kr*(1-(1.173*(0.2775-Kr)/Kd*11))))-1.517;
F(2)=(Kd*11/0.2775*(0.2775/Kr*(1-(1.173*(0.2775-Kr)/Kd*11)))^-(Kr/0.2775-Kr))-6.643;
end
I'm trying to solve for Kr & Kd obviously but, at the moment, I'm getting Kr = 0.2894 and Kd = 0.2366 (Initial Guess [0.1;0.1]). The text I'm working from has the solution as 1.159 and 0.97 respectively. I'm wracking my brains but figure I have translated the equation badly?
Any help appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!