Método De Integración

Páginas: 2 (341 palabras) Publicado: 31 de enero de 2013
PROGRAMA DE
INTEGRACION

% INTEGRACION NUMERICA
fprintf (' INTEGRACION NUMERICA\n');
fprintf ('metodo del trapecio y metodo de simpson 1/3 \n');
fprintf (' Nombre \n');
fprintf ('No. de lista___ \n ')
fprintf('***** DATOS ***** \n');
% +++++++++++++ DATOS ++++++++++++++++++
npun =input ('numero de puntos = ');
% ******DIMENSIONAMIENTO DE X y Y******
x=zeros(npun,1);y=zeros(npun,1);
% ***DATOS DEL VECTOR X y DEL VECTOR Y***
for i=1:npun
fprintf('X(%3.0f)=',i);
x(i)=input(' ');
end
for i=1:npun
fprintf('Y(%3.0f)=',i);
y(i)=input(' ');
end
h=x(2)-x(1);

ALGORITMODEL METODO DEL TRAPECIO
ALGORITMO
CODIFICACIÓN

% ALGORITMO DEL METODO DEL TRAPECIO

xx=0.0;
n1

yi
i1

y

h
( y1 y n
2

n1

2

yi )
i2

for i=2:npun-1
xx=xx+y(i);
endarea1=(h/2.)*(y(1)+y(npun)+2.*xx);

ALGORITMO DEL METODO DE SIMPSON 1/3
ALGORITMO
CODIFICACIÓN

%****ALGORITMO DEL METODO DE SIMPSON 1/3
d1=npun/2;
d2=fix(npun/2);
if(d1 == d2)
%* numeracionpar hacer ajuste *
nfin=npun-1;
vfpar=npun-2;
vfimpar=npun-3;
iny=(h/2)*(y(npun-1)+y(npun));
else
%* numeracion impar no ajuste *
nfin=npun;
vfpar=npun-1;
vfimpar=npun-2;
iny=0;
end ALGORITMO DEL METODO DE SIMPSON 1/3
ALGORITMO
CODIFICACIÓN

xx

yy

h
( y1 y n
3

ordenadas
de orden par

ordenadas
de orden impar

4 * xx 2 * yy )

xx=0.0;
for i=2:2:vfparxx=xx+y(i);
end

yy=0.0;
for i=3:2:vfimpar
yy=yy+y(i);
end

area2=(h/3)*(y(1)+y(nfin)+4.*xx+2.*yy)+iny;

Nota
n = número impar no hay ajuste iny=0
n = número par hay ajuste iny=(h/2)*(yn-1+yn) PROGRAMA DE
INTEGRACION

% RESULTADOS
fprintf('RESULTADOS \n ');
fprintf('METODO DEL TRAPECIO \n');
fprintf('area = %15.8f \n ',area1);
fprintf('METODO DE SIMPSON 1/3 \n');fprintf('numero de datos par,ajuste, ultimo intervalo por trapecio \n');
fprintf('numero de datos impar no ajuste \n');
fprintf('area = %15.8f \n ',area2);
fprintf (' ***** FIN DEl PROGRAMA *****');

Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • métodos de integracion
  • Metodos de integracion
  • METODOS DE INTEGRACIÓN
  • Metodo de integracion
  • Método de integración
  • Metodos De Integracion
  • metodos de integracion
  • Metodos de integracion

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS