MATLAB Answers

How would I plot a piecewise summation.

4 views (last 30 days)
Ben Phelps
Ben Phelps on 27 Nov 2020
Commented: Ben Phelps on 29 Nov 2020
Would anyone be able to help me to plot this equation in MATLAB?

  0 Comments

Sign in to comment.

Accepted Answer

Alan Stevens
Alan Stevens on 28 Nov 2020
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')

More Answers (0)

Categories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by