How do I create several step lines and time delay in a matlab program?
显示 更早的评论
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 个评论
Azzi Abdelmalek
2012-9-16
why paue(0.01)? wat do you want to do?
Robert
2012-9-16
Walter Roberson
2012-9-16
回答(2 个)
Azzi Abdelmalek
2012-9-16
编辑:Azzi Abdelmalek
2012-9-16
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
2012-9-16
0 个投票
1 个评论
Azzi Abdelmalek
2012-9-16
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);
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!