a=0
b=2
n=256
h=(b-a)/n
x=a
sigma=0
for i=1:n-1;
x=x+h
xr=x/2
fr=((4*xr)-(xr^3))*exp(xr^2)
printf('%11.6f \t %11.6f \t %11.6f \n',i/2,xr,fr);
sigma=sigma+((4*xr)-(xr^3))*exp(xr^2)
end
disp("Hasil perhitungan titik tengah= ")
printf('%11.6f',sigma)
b=2
n=256
h=(b-a)/n
x=a
sigma=0
for i=1:n-1;
x=x+h
xr=x/2
fr=((4*xr)-(xr^3))*exp(xr^2)
printf('%11.6f \t %11.6f \t %11.6f \n',i/2,xr,fr);
sigma=sigma+((4*xr)-(xr^3))*exp(xr^2)
end
disp("Hasil perhitungan titik tengah= ")
printf('%11.6f',sigma)
0 comments :
Post a Comment