Write a while loop for x(i-1)=0.2+3^(x(i)) with x(i=0)=50 until x<1 and show the final value of i

1 view (last 30 days)
I really need help please. I don't understand how to do this when i is decrementing. My code is:
clear all
x_old = 100;
x_new = 10; %initialize the x_new value, > 1
i = 0; %current value of the counter
while x_new > 1
x_new = .2+3^(x_old);
i = i-1
x_old = x_new;
end
  1 Comment
sixwwwwww
sixwwwwww on 10 Oct 2013
Dear Rob, I wonder that the problem is with the equation. You can see that in first iteration you have 3^(100) = 5.1538e+47 and in next iteration you will have 3^(5.1538e+47) = ??? The resulting values are are too much large so you should verify your equation. Good luck

Sign in to comment.

Answers (0)

Categories

Find more on Programming 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!