How can I increase the decimal digits and control them in future .... How should I modify my program to do so ???
1 view (last 30 days)
Show older comments
FOR EXAMPLE , WHAT SHOULD I DO TO INCREASE THE DECIMAL DIGITS TO 50 OR 100 ??? PLEASE, SHOW ME THE WAY ... clear all clc x=(-0.1); y=(0); fprintf(' i x \n') fprintf(' --- ------------- \n')
for i=1:4;
fx=(x(i))^3-(x(i))^2+2;
fxx=3*(x(i))^2-2*(x(i));
y(i)=x(i)-(fx/fxx);
fy=(y(i))^3-(y(i))^2+2;
fyy=3*(y(i))^2-2*(y(i));
x(i+1)=x(i)+([fy-fx]/fyy);
end
for i=1:length(x)
fprintf('%2i %18.15f\n',i,x(i))
end
%%THE RESULTS ARE
i x
--- -------------
1 -0.100000000000000
2 -3.119140528362807
3 -1.474069695697443
4 -1.017351956185236
5 -1.000001047082565
1 Comment
Stephen23
on 24 Jan 2017
duplicate:
https://www.mathworks.com/matlabcentral/answers/321657-i-need-more-decimal-digits-than-the-default-for-the-values-of-x
Answers (0)
See Also
Categories
Find more on Entering Commands 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!