Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

For If: %solusi Persamaan

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

syms x

fx = 2000*log(140000/(140000-2100*x))-9.8*x;
a = 8;
b = 30;
h=(b-a)/4;
n=100;
fa= subs(fx,x,a); Hasil :
fb= subs(fx,x,b);
fd= 0; Ik =
ff= 0;
for i=1:(n-1) 1.4386e+004 +1.5205e+004i
if rem (1,2)==0
fc = subs(fx,x,i);
fd = fd+fc;

else Ih =
fe= subs(fx,x,i);
ff= fe+ff; 1.1061e+004
end
end
Ik= (fa+4*ff+2*fd+fb)*h/(3*n)
e=
t = int(fx);
t1= subs (t,x,a); 1.4071
t2= subs(t,x,b);
Ih= t2-t1

e= abs ((Ih-Ik)/Ih)

syms x y
fx = 4*exp(0.8*x)-0.5*y; Hasil :
x0 = -7;
y0 = 2; N=
xn = 3;
n = 10;
h = (xn-x0)/n;
N = [];
1.0000 -6.0000 1.2320 1.4206
%solusi persamaan
t = 3; 2.0000 -5.0000 0.7886 1.2692
p = -0.22067*((10^-3)*t)-2.9282;
3.0000 -4.0000 0.5698 1.1946
for i = 1:n
k1 = subs(fx,{x,y},{x0,y0}); 4.0000 -3.0000 0.5491 1.1875
k2 = subs(fx, {x,y}, {x0+0.5*h,y0+0.5*k1*h});
k3 = subs(fx, {x,y}, {x0+0.5*h,y0+0.5*k2*h}); 5.0000 -2.0000 0.7856 1.2682
k4 = subs(fx, {x,y}, {x0+h,y0+k3*h});
y1 = y0+1/6*(k1+2*k2+2*k3+k4)*h;
x1 = x0+h; 6.0000 -1.0000 1.4836 1.5066
es = abs ((y1-p)/p);
N = [N; i x1 y1 es]; 7.0000 0 3.1413 2.0725
y0 = y1;
x0 =x1; 8.0000 1.0000 6.8935 3.3537
end
N 9.0000 2.0000 15.2827 6.2180

10.0000 3.0000 33.9763 12.6005


syms x y Hasil :
f = 4*exp(0.8*x)-0.5*y;
x0 = 0; N=
y0 = 3;
a = 0;
b = 10;
n = 10;
h = (b-a)/n; 1.0e+003 *
N = [];

for i=1:n
y1 = y0 + subs(f,{x,y},{x0,y0})*h; 0.0010 0.0010 0.0055
x1 = x0 + h;
N = [N; i x1 y1]; 0.0020 0.0020 0.0117
x0 = x1;
y0 = y1; 0.0030 0.0030 0.0256
end
0.0040 0.0040 0.0569
N
0.0050 0.0050 0.1266

0.0060 0.0060 0.2817

0.0070 0.0070 0.6269

0.0080 0.0080 1.3951

0.0090 0.0090 3.1050

0.0100 0.0100 6.9102

You might also like