lab2.docx - Paso 1 function[res n]=miexp(x err_max/funcion que calcula la exponencial x exponente de e err_max máximo error aproximado permitido res

lab2.docx - Paso 1 function[res n]=miexp(x err_max/funcion...

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

Paso 1 function [ res , n ] = miexp ( x , err_max ) //funcion que calcula la exponencial // x: exponente de e // err_max: máximo error aproximado permitido // res : resultado (e^x) // n: cantidad de iteraciones // Arrancamos dando las condiciones iniciales n = 1 ; // contador de interaciones res = 1 ; // Resultado final 1 + sum( . . . ) xn = x ; // variable que guarda x^n nfact = 1 ; // variable que guarda n! err_aprox = 100 // En la primera iteracion no tiene sentido hablar // de error , pero necesitamos empezar con algo para // que el ciclo "while" pueda arrancar // Iteramos hasta que el próximo // término sea menor o igual err_max while err_aprox > err_max termino = xn / nfact; // Término de la serie res = res + termino; // Nuevo valor mejorado // Cálculo del error , lea el comentario sobre éste cálculo en la guía err_aprox = abs ( termino / res ) ; n = n + 1 ; xn = xn .* x ; nfact = nfact .* n ; end endfunction Paso 2
Image of page 1

Subscribe to view the full document.

Paso 3
Image of page 2
Paso 4 Paso 5
Image of page 3

Subscribe to view the full document.

Paso 6 Paso 7 // Este guion ( script ) sirve para // investigar el comportamiento de la // aproximacion del exponencial .
Image of page 4
Image of page 5
  • Fall '18
  • Norma

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes