How can I increase the decimal digits and control them in future .... How should I modify my program to do so ???
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Stephen23
2017-1-24
duplicate:
https://www.mathworks.com/matlabcentral/answers/321657-i-need-more-decimal-digits-than-the-default-for-the-values-of-x
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!