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!