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!