I'm currently writing a code in MATLAB that plots the convergence of 1/N!, Where N goes from 1-10. I've created a for loop that calculates 1/N! for each value from 1-10 but how do I add each of the values calcuated in the for loop in a vector array?
clc,clear
Nterms = 10;
total = 0;
for ns = 0:Nterms
newterm = 1/(factorial(ns));
disp(['The term ',num2str(ns),' is:',num2str(newterm)])
total = total + newterm; % Sum of series
end