how to solve an equation by using trial and error method?
33 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Sam Chak
2022-5-16
I'm not sure what the trial-and-error method is for this, but I think that basic Algebraic methods can be used to rearrange the equation. I followed the example in fzero and make an assumption:
% Assume
gamma = 1.55526564459735;
% function to be solved
f = @(M) (1/M)*((2*(1 + (gamma - 1)/2*M^2))/(gamma + 1))^((gamma + 1)/(2*(gamma - 1))) - Ax/Astar;
% initial guess
M0 = 3;
% root-finding solver
Msol = fzero(f, M0)
There should be two real roots.
更多回答(1 个)
Walter Roberson
2022-5-16
Multiply both sides by Mx. Subtract the left side from the right. Expand out. You now have a polynomial of degree 2 in Mx.
2 个评论
Walter Roberson
2022-5-16
Ah, I am on mobile. I had tried scrolling the image but it didn't scroll so I didn't see the power.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!