Академический Документы
Профессиональный Документы
Культура Документы
MATLAB
Aceha Jazaul Aufa (ID 03411640000057)
Department of Geophysics Engineering, Faculty of Civil, Environmental, and Geoscience
Engineering, Sepuluh Nopember Institute of Technology. Surabaya
ABSTRACT
Mathematical calculations are very complex. in science experiments requires efficient
mathematical calculations. One example of a familiar calculation is looking for square roots of
various numbers.in this case, using unfamilliar numbers like 0, 2, 10, and -4. Using MATLAB to
find the square root of these numbers with an error limit 0,0001. Script used a repetition function
to find where the square root reaches the condition and if it has reached the condition it will be
stopped. Then the square root obtained is inf, 1.4142, 3.1623 and 0 + 2i.
ATTACHMENTS
a=0
clear all
clc
%Parameter
a1 = 0
t1 = sqrt(a1)
n = 1
x1(1)=10
%Formula
while n <= 100
x1(n+1)= 0.5.*(x1(n)+(a1./x1(n)))
error = abs((x1(n+1)-t1)./t1)
if error <= 0.0001
break
else
n = n+1;
end
end
a=2
clear all
clc
%Parameter
a1 = 2
t1 = sqrt(a1)
n = 1
x1(1)=10
%Formula
while n <= 100
x1(n+1)= 0.5.*(x1(n)+(a1./x1(n)))
error = abs((x1(n+1)-t1)./t1)
if error <= 0.0001
break
else
n = n+1;
end
end
a = 10
clear all
clc
%Parameter
a1 = 10
t1 = sqrt(a1)
n = 1
x1(1)=10
%Formula
while n <= 100
x1(n+1)= 0.5.*(x1(n)+(a1./x1(n)))
error = abs((x1(n+1)-t1)./t1)
if error <= 0.0001
break
else
n = n+1;
end
end
a = -4
clear all
clc
%Parameter
a1 = -4
t1 = sqrt(a1)
n = 1
x1(1)=10
%Formula
while n <= 100
x1(n+1)= 0.5.*(x1(n)+(a1./x1(n)))
error = abs((x1(n+1)-t1)./t1)
if error <= 0.0001
break
else
n = n+1;
end
end