MATLAB: How to plot a piecewise summation.

series

Would anyone be able to help me to plot this equation in MATLAB?

Best Answer

Something like this?
tau = 1;
t = 0:0.1:10;
n = ceil(t/tau);
for i = 1:numel(n)
S = 0;
for k = 1:n(i)
S = S + (-1)^k*(t(i) - (k-1)*tau)^k/factorial(k);
end
u(i) = 1 + S;
end
plot(t,u),grid
xlabel('t'),ylabel('u')
Related Question