필터 지우기
필터 지우기

Plotting selected data from time series

조회 수: 23 (최근 30일)
Pankaj
Pankaj 2017년 7월 20일
편집: alice 2017년 7월 20일
Say ts is a timeseries object with three data colums. Storing min temperature, max temperature and humidity. I am interested in just plotting min and max temperature. How can I get it done?
I need something like plot(ts(:, 1:2)) ( I know this won't work)

채택된 답변

alice
alice 2017년 7월 20일
If you want to plot the time versus the min temperature and the time versus the max temperature and if your min temperature is on the first column of the data of your timeseries and the the max temperature in the second, then access those and plot them:
plot(ts.time,ts.data(:,1), ts.time,ts.data(:,2));
  댓글 수: 2
Pankaj
Pankaj 2017년 7월 20일
ts.time produces numeric values. I want to avoid the lengthy way. Any other suggestions?
alice
alice 2017년 7월 20일
편집: alice 2017년 7월 20일
You can adapt it so you don't plot the time:
figure; hold on; grid on;
plot(ts.data(:,1))
plot(ts.data(:,2));
xlabel('index');
legend('tempMin','tempMax')
The documentation would have helped you, you could try reading doc plot and doc hold.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by