How do I create several step lines and time delay in a matlab program?
Mostrar comentarios más antiguos
I would like to create a step lines in a plot, also impose a time delay of 10ms. However, when I create the plot, it is only showing one line. Can you tell me if I did something wrong?
Basically, what I am trying to construct is for any t, the Im will be the same as Im will be equal to Iinj. Since Iinj = -1.5:0.5:1.5, I should have 7 step lines in the plot. However, I am not achieving this with this code. I am new to programming, can you help? Thanks.
R = 10;
C = 2;
A = 1;
t = 0:0.03333:0.2;
pause (0.01);
Iinj = -1.5:0.5:1.5;
for i = length(Iinj);
for j = t;
Im = Iinj;
end
end
plot(t, Im(i));
3 comentarios
Azzi Abdelmalek
el 16 de Sept. de 2012
why paue(0.01)? wat do you want to do?
Robert
el 16 de Sept. de 2012
Walter Roberson
el 16 de Sept. de 2012
Respuestas (2)
Azzi Abdelmalek
el 16 de Sept. de 2012
Editada: Azzi Abdelmalek
el 16 de Sept. de 2012
try this
close
R = 10; C = 2; A = 1;
ts=0.03333
t = 0:ts:0.2;
Iinj = -1.5:0.5:1.5;
t1=-0.1:ts:0-ts;
t2=0.2+ts:ts:0.2+0.1;
time=[t1 t t2 ]
Im=[zeros(1,length(t1)) t zeros(1,length(t2))]
plot(time, Im);
Robert
el 16 de Sept. de 2012
0 votos
1 comentario
Azzi Abdelmalek
el 16 de Sept. de 2012
is that what you want?
close
R = 10; C = 2; A = 1;
ts=0.03333
t = 0:ts:0.2;
Iinj = -1.5:0.5:1.5;
t1=-0.1:ts:0-ts;
t2=0.2+ts:ts:0.2+0.1;
time=[t1 t t2 ]
Im=[zeros(1,length(t1)) t zeros(1,length(t2))]
plot(time, Im);
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!