velocity of a rocket (bisection root finding)
Show older comments
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)
Answers (1)
Walter Roberson
on 24 Sep 2015
Edited: Walter Roberson
on 24 Sep 2015
myFunction = @(x) (1800*(log(160000/(160000-(2600*x)))))-(9.812*x) - 750;
and you will want to change your starting x values.
Categories
Find more on Common Operations 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!