You are on page 1of 3

%INTEGRACIÒN NUMÈRICA

% 02
x=-1:0.05:4;
f=abs(x.^2-2.*x+3);
bar(x,f,'r')
grid on

%CALCULANDO AREAS
syms x
f1=x.^2-2.*x+3;
A1=int(f1,-1,4)

a1=65/3

%AREA total =21.666666666666668

%03
x=-2:0.05:3;
f=abs(2.*x.^2+4.*x-1);
bar(x,f,'r')
grid on

syms x
f1=abs(2.*x.^2+4.*x-1);
A1=int(f1,-2,0.2247)

a1=4.782823071184667

syms x
f2=abs(2.*x.^2+4.*x-1);
A2=int(f2,0.2247,3)

a2=33.116156404518001

%AREA total=37.898979475702667

%01
%REGLA COMPUESTA DEL TRAPECIO
x=2:0.05:9;
f=abs(exp(-x).*cos(4.*x));
bar(x,f,'r')
grid on

%CALCULO DE NODOS

% h=7/12

format rat
k=[0,1,2,3,4,5,6,7,8,9,10,11,12];
x=2+k*(3/4)
%calculo de sumas
format long
x=[2,9];
f=abs(exp(-x).*cos(4.*x));
sum(subs(f,x))

x=[7/2,17/4,5,23/4,13/2,29/4,8];
f=abs(exp(-x).*cos(4.*x));
sum(subs(f,x))

f=(((7/13)./2).*(0.039414160520585))+(7/11).*(600/6001)

% f= 0.074237264098682

%02
%REGLA COMPUESTA DEL TRAPECIO
x=1:0.05:8;
f=2+cos(sqrt(2.*x));
bar(x,f,'r')
grid on
%CALCULO DE NODOS
h=7/10
format rat
k=[0,1,2,3,4,5,6,7,8,10,11];
x=1+k*(7/10)
%calculo de sumas
format long
x=[1,8];
f=2+cos(sqrt(2.*x));
sum(subs(f,x))
% 4567/652
x=[17/10,12/5,31/10,19/5,9/2,26/5,59/10];
f=2+sin(sqrt(2*x));
sum(subs(f,x))
% 30433/293
f=((7/11)./2).*(4567/652)+(7/11).*(1.156901872175564e+02)
format long
%75.849764983397563

You might also like