Taylor series for e^x with loop
18 views (last 30 days)
Show older comments
How would I solve this problem and only compute the first 12 interations?
6 Comments
Answers (1)
Lateef Adewale Kareem
on 19 Jul 2022
%% This is more efficient
x = 2;
v = 1;
n = 1;
d = 1;
for i = 1:20
n = n*x;
d = d*i;
v = v + n/d;
end
fprintf('Computed Value: %f', v)
1 Comment
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!