Exponential Function using Taylor series
Afficher commentaires plus anciens
Hi, I've been trying to write a code which has a row vector input of numbers (x in my code) and the output is row vector e^x (y in my code). e^x is given by the sum of: x^n/n! where n=0,1,2... I have to try and write an unbounded while loop with these conditions: n has a maximum of 50 and that y is more than 0.001 (if less than 0.001, sequence is terminated).
This is what I've done:
the problem is:
1)i've written a loop for the factorial function in a different script, how do i input that into this one?
2)my output is still less than 0.001 when it shouldn't have happened. when given this row vector: [-2 -1.5 -1] the output should be [0.1365 0.2232 0.3679] but I do not obtain these numbers. :(
Any help would be amazing! thanks :)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!