Time series plots for a Project: Urgent
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
I have a Speed and time stamp huge data sets. Speed is in numeric but time stamp is in char. I would like to plot speed vs time stamp. My x axis should have the format 'mm-year'. can I also know how to adjust the intervals on x axis in matlab.
for an example: Speed=[ 20 30 50 60]; Timestamp= [ 12-Dec-2014, 12-Jan-2015, 12-Feb-2015, 12-Mar-2015]; (its in char)
Now I would like to plot Speed vs Time stamp, with my x labels to be in mm-year. How can I do this????
답변 (2개)
Star Strider
2015년 4월 23일
This works:
Speed=[ 20 30 50 60];
Timestamp= ['12-Dec-2014'; '12-Jan-2015'; '12-Feb-2015'; '12-Mar-2015'];
dnv = datenum(Timestamp, 'dd-mmm-yyyy');
figure(1)
plot(dnv, Speed)
datetick('x', 'mm-yyyy')
grid
댓글 수: 0
Peter Perkins
2015년 4월 24일
Another option, if you are using MATLAB R2014b or later, is this:
Speed = [20 30 50 60];
Timestamp = ['12-Dec-2014'; '12-Jan-2015'; '12-Feb-2015'; '12-Mar-2015'];
Time = datetime(Timestamp);
plot(Time,Speed,'DatetimeTickFormat','MMM-yyyy')
This makes a plot that can be panned and zoomed.
댓글 수: 0
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!