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

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

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)

Asked:

Rob
on 10 Oct 2013

Commented:

on 10 Oct 2013

Community Treasure Hunt

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

Start Hunting!