image thumbnail
from Essential MATLAB by Brian Hahn
Companion software for Essential MATLAB for Scientists and Engineers

newton.m
a = 2;
x = a/2;

for i = 1:6
	x = (x + a / x) / 2;
	disp( x )
end

disp( 'Matlab''s value: ' )
disp( sqrt(2) )

Contact us at files@mathworks.com