How would I plot a piecewise summation.

 Respuesta aceptada

Alan Stevens
Alan Stevens el 28 de Nov. de 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')

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 27 de Nov. de 2020

Comentada:

el 29 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by