필터 지우기
필터 지우기

Seasonal Variability of time series

조회 수: 4 (최근 30일)
Aoyi
Aoyi 2018년 5월 6일
I would like to find out the seasonal variability of the data. My data is form 1883-2018 temperature. Each month has several data. I tried to calculate the average of each month and do the seasonal variation. But I got NaN for sst. Here is my code.
MIDAS00525temp = load('../TimeseriesProject/MIDAS_srcid00525_daily_temperature.txt');
tempmin = MIDAS00525temp (:,3);
tempmin(tempmin<0) = NaN; MATLABDate_temp = MIDAS00525temp(:,2);
tempfilled = inpaint_nans(tempmin, 3);
[Y,M] = datevec(MIDAS00525temp(:,2));
[a,~,c] = unique([Y,M],'rows'); yearaveragemin = [a, accumarray(c,MIDAS00525temp(:,3),[],@(x)mean(x))];
datayearaveragemin = (yearaveragemin(:,3));
MATLABDate_temp = datenum(yearaveragemin(:,1), yearaveragemin(:,2), 0);
% Make a moving average
temp_medfiltmin = medfilt1(datayearaveragemin, 36, 'omitnan', 'truncate'); xt = datayearaveragemin - temp_medfiltmin; T = length(MATLABDate_temp);
% Create seasonal indices
s = 12; % number of timesteps per year sidx = cell(s,1); for i = 1:s sidx{i,1} = i:s:T; end % Apply a stable seasonal filter.
sst = cellfun(@(x) mean(xt(x)),sidx);

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by