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.
calculate delta changes in times series (monthly)
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
Akzeptierte Antwort
KSSV
am 22 Feb. 2018
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) ;
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!