velocity of a rocket (bisection root finding)
2 ビュー (過去 30 日間)
古いコメントを表示
I am completely at a loss. Any suggestions are appreciated. I am not looking for the answer, just something to get me started since I'm confused.
I have started one string but I am not sure how using the 750 comes into play. Thanks -
myFunction = @(x) (1800*(log(160000/(160000-(2600*x)))))-(9.812*x);
x_lower = 749;
x_upper = 751;
x_mid = (x_lower + x_upper)/2;
counter = 1;
while abs(myFunction(x_mid)) > (1*(10^(-4)))
if (myFunction(x_mid) * myFunction(x_upper)) < 0
x_lower = x_mid;
else
x_upper = x_mid;
end
x_mid = (x_lower + x_upper)/2;
counter = counter + 1;
end
fprintf('The root is %.7f\n', x_mid);
fprintf('Number of iterations done: %g\n', counter)
0 件のコメント
回答 (1 件)
Walter Roberson
2015 年 9 月 24 日
編集済み: Walter Roberson
2015 年 9 月 24 日
myFunction = @(x) (1800*(log(160000/(160000-(2600*x)))))-(9.812*x) - 750;
and you will want to change your starting x values.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!