integracion.docx - clc; clear all; disp(': MÉTODOS DE...

This preview shows page 1 - 5 out of 7 pages.

The preview shows page 3 - 5 out of 7 pages.
clc;clear all;disp(':::::::::::::: MÉTODOS DE INTEGRACION NUMERICA ::::::::::::::')disp('Seleccione El Metodo a Aplicar')disp('1. Regla Trapezoidal')disp('2. Regla Simpsom 1/3')disp('3. Regla Simpsom 3/8')disp('4. Salir ...')eleccion = input('Ingrese su Opcion: ');switch eleccioncase 1disp('');disp('Regla Trapezoidal')disp('');fx = input("INGRESE LA FUNCION: ", "S");funcion = inline(fx);fxll = input("INGRESE LA SEGUNDA DERIVADA DE LA FUNCION: ", "S");funderiva = inline(fxll);a = input("INGRESE EL VALOR DEL LIMITE INFERIOR a: ");b = input("INGRESE EL VALOR DEL LIMITE SUPERIOR b: ");t=a:b;n = input("INGRESE EL VALOR n: ");deltaX = (b - a)/n;
i = 0;resutadoanterior=0;resusltdoactual=0;if i==0i++;X0=a+i*deltaX;resultadoX0=funcion(X0);endifwhile i>0 && i<nXintermedio=a+i*deltaX;factual=Xintermedio;resultado=(2*funcion(factual));resusltdoactual=resultado;resultadofinal= resutadoanterior+resusltdoactual;resutadoanterior=resultadofinal;i++;endif i==n;Xn=a+i*deltaX;resultadoXn=funcion(Xn);endifresul = (deltaX/2)*(resultadoX0+ resultadofinal + resultadoXn);fprintf("EL RESULTADO ES: %0.4f\n", resul)error=(((b-a)^3)/(12*(n^4)))*(max(funderiva(t)));fprintf("EL ERROR ES: E<=%0.4f\n", error);case 2disp('');

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 7 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
N/A
Tags
Integraci n, S, input INGRESE LA

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture