필터 지우기
필터 지우기

calculate delta changes in times series (monthly)

조회 수: 2 (최근 30일)
Jake_K
Jake_K 2018년 2월 22일
댓글: Jake_K 2018년 2월 22일
I have a time series of lake level heights over time.
It looks like this:
% code
end
Date Level
1992/10/21 803.83
1992/11/15 803.77
1992/12/03 803.81
1993/01/18 803.95
1993/02/15 804.21
1993/04/16 804.37
1993/06/10 803.94
1993/10/26 803.59
... and so on for 25 years.
Unfortunately my intervals aren't whole months. Sometimes I have like something beween 1-2 months between two measurements. But in the end I want to calculate the monthly lake level change. In other words: dh/dt where dt = 1 month.
I was thinking of calculating the interval between the first and last measurement what gives me a total of 290 months. So in the end I should have 290 dt's. Then I think I have to interpolate between the values to obtain maybe a value for every day to finally calculate monthly dt's. There my Matlab skills end. I hope someone can help me out with this.
Thank you!
  댓글 수: 1
Jake_K
Jake_K 2018년 2월 22일
I do have the interpolation now. I.e. for every day between the first and last day of the time series I have an interpolated value. The tricky thing seems to me now to calculate the difference between the value on the first and last day of every month. And this for all 24 years... I'd be grateful again for some inputs.

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

채택된 답변

KSSV
KSSV 2018년 2월 22일
YOu create the dates you want and do interpolation using interp1, to get the data for each day. Check this example:
T1 = datetime(datestr('1992/10/21'));
T2 = datetime(datestr('1993/10/26')) ;
T = (T1:T2)';
data = rand(size(T)) ;
% make some data missing / This is the original data
idx = randperm(length(T),100) ;
X = T ; Y = data ;
X(idx) = [] ;
Y(idx) = [] ;
% Do inteprolation
Yi = interp1(X,Y,T) ;
  댓글 수: 1
Jake_K
Jake_K 2018년 2월 22일
Thank you. I finally made it. Another question: How do I calculate for every month the difference between the value of the first day and of the last day of a month?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Adding custom doc에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by