Exponential Function using Taylor series
이전 댓글 표시
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 :)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!