필터 지우기
필터 지우기

calculation of time series.

조회 수: 3 (최근 30일)
SONI SONI
SONI SONI 2015년 11월 6일
댓글: SONI SONI 2015년 11월 9일
I have monthly (420 months) time series data of temperature . I need to calculate a another time series based on following formula:
x = T(month,i) - T(month,i-1)
where, T(month,i) is temperature of current month
T(month,i-1) is temperature of previous month
how to create a time series of x ?

답변 (3개)

Thorsten
Thorsten 2015년 11월 6일
편집: Thorsten 2015년 11월 6일
diffdata = diff(ts.Data)
difftime = ts.Time(1:end-1)+diff(ts.Time)/2;
tsdiff = timeseries(diffdata, difftime)

Image Analyst
Image Analyst 2015년 11월 6일
If the second index is the month number, what does the first index represent? Have you tried
x = diff(T(month,:))?
  댓글 수: 2
SONI SONI
SONI SONI 2015년 11월 6일
both represents month. month,i is number of month. we can write x = T(i) - T(i-1)
suppose i is current month (January) and i-1 is previous month (December)
Image Analyst
Image Analyst 2015년 11월 6일
But originally you said T was a 2-D array - it had two indexes: for a row and a column. Now you're saying T is a 1D array taking only one index. Totally inconsistent. Which is it?????

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


SONI SONI
SONI SONI 2015년 11월 9일
Temperature is 2-D array. I am trying to say I have a arrays T (time series of temperature January to December 1*12). now I want to substrate temperature values from current month to previous month. for example feb - jan, mar - feb....
But I have solved this problem
x(i) = T(i) - T(i-1)
  댓글 수: 2
Image Analyst
Image Analyst 2015년 11월 9일
Now you're back to a 1-D array, NOT a 2-D array despite what you say, because it has only 1 index.
And your code just does diff() which is the same as what I gave you except in a function instead of a for loop.
I give up.
SONI SONI
SONI SONI 2015년 11월 9일
Thank you sir, for the interest to help me.

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

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by