what is wrong with this code
5 views (last 30 days)
Show older comments
clc; clear variables;
x(1)=0;
tic
for i=1:500
x(i+1)=(x(i).^2)*0.5+4;
if abs((x(i+1)-x(i)))<=0.00000001
break
else
x(i)=x(i+1);
end
end
toc
0 Comments
Accepted Answer
Hiro Yoshino
on 16 Jan 2020
if abs((x(i+1)-x(i)))<=0.00000001
This condition is less likely to be met ... I think.
More Answers (0)
See Also
Categories
Find more on Whos 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!