how do i write a scrip for finding the loop of sin figures
2 次查看(过去 30 天)
显示 更早的评论
using this equation
2 个评论
Dyuman Joshi
2022-6-7
If you need help starting, refer to - Babylonian Method of computing Square Root
回答(1 个)
Abhijit Nayak
2022-6-7
This is a method of finding square-root of a number using Babylonian Method.
The following code is for your required significant figures which you can change according to your need.
x=15;
xn=x./2;
err=abs(xn-x./xn);
while any(err>1e-4)
xn=0.5.*(xn+x./xn);
err=abs(xn-x./xn);
end
y=xn;
fprintf("the ans is %.4f",y);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!