Boucle for add the element behind

6 visualizaciones (últimos 30 días)
Billel Bekakchi
Billel Bekakchi el 20 de Feb. de 2021
Respondida: Alan Stevens el 21 de Feb. de 2021
i want to add teh element behind for exemple when i =3
i want to add the element when i=1 to i=3 and plot it evry time till the i=9
so for i=9 --> means you add evry thing in the back i=1 i=3 i=5 i=7
f=1;
T=1/f;
t=-1:T/300:1;
sq=1*square(2*pi*f*t);
figure
plot(t,sq)
hold on
for i=1:2:9
v=i+2
x_i=(4/(pi*i))*sin((2*pi*i*t));
x_v=((4/(pi*v))*sin((2*pi*v*t)));
r=x_i+x_v;
plot (t,r);
hold on
end

Respuesta aceptada

Alan Stevens
Alan Stevens el 21 de Feb. de 2021

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by