velocity of a rocket (bisection root finding)

1 次查看(过去 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)

回答(1 个)

Walter Roberson
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.

Community Treasure Hunt

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

Start Hunting!

Translated by