Beginner's question about data plot
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시

The data used for this plot is a series of 0's followed by a series of 1's, then back to 0's. I expected to see a 0-1-0 pulse shaped signal starting at around 15 minutes and ending just before 50 minutes, but instead I see a starting and trailing slope. What causes this behavior? The code is as simple as it gets:
figure(1), plot(time,Enable_d)
title('Signal Enabled')
xlabel('Time (min)')
댓글 수: 2
KALYAN ACHARJYA
2019년 12월 3일
How you expected to switch from 1 to 0, in plot its connect both data points have you look at stem?
figure(1), stem(time,Enable_d)
title('Signal Enabled')
xlabel('Time (min)')
Raimund Herberg
2019년 12월 3일
답변 (4개)
the cyclist
2019년 12월 3일
Try this instead
plot(time,Enable_d,'.','MarkerSize',32)
This code will plot individual points, without a connecting line.
댓글 수: 0
Raimund Herberg
2019년 12월 3일
0 개 추천
댓글 수: 1
the cyclist
2019년 12월 3일
How do you expect MATLAB to "know" how to fill in the gap from 15 to 40? How can it know you want it to be 1 right after Time = 15, rather than 0, or 0.5, or 0.73245?
The answer is -- MATLAB can't know what to plot there unless to program it to.
Raimund Herberg
2019년 12월 3일
0 개 추천
댓글 수: 4
the cyclist
2019년 12월 3일
편집: the cyclist
2019년 12월 3일
It seems pretty clear from the plot (using my answer) that you have no data between 15 minutes and 40 minutes, or before about 13 minutes or so. (You might want to make the MarkerSize a little bit smaller than the 32 I chose, to see the individual data points better.)
Can you upload the data in a *.mat file?
Also, you keep "answering" your question, rather than commenting on other answers, which will get very confusing (especially if people start upvoting some answers).
Raimund Herberg
2019년 12월 3일
Image Analyst
2019년 12월 3일
Did stairs() like in my answer not work? Did you even try it?
Raimund Herberg
2019년 12월 3일
Image Analyst
2019년 12월 3일
0 개 추천
To get a plot with sharp, not sloping, edges, use stairs() or bar().
댓글 수: 0
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

