How do I create several step lines and time delay in a matlab program?
Ältere Kommentare anzeigen
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 Kommentare
Azzi Abdelmalek
am 16 Sep. 2012
why paue(0.01)? wat do you want to do?
Robert
am 16 Sep. 2012
Walter Roberson
am 16 Sep. 2012
Antworten (2)
Azzi Abdelmalek
am 16 Sep. 2012
Bearbeitet: Azzi Abdelmalek
am 16 Sep. 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
am 16 Sep. 2012
0 Stimmen
1 Kommentar
Azzi Abdelmalek
am 16 Sep. 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);
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!