필터 지우기
필터 지우기

How to Remove Seasonal Cycle?

조회 수: 6 (최근 30일)
FIONA HOTCHKISS
FIONA HOTCHKISS 2021년 12월 7일
답변: Star Strider 2021년 12월 7일
%Point Barrow, Alaska
PB=readtable('monthly_flask_co2_ptb.csv');
%create time and CO2 variable
%time
PBdailyt=PB(:,4);
%CO2
PBdailyCO2=PB(:,7);
%take data out of table and put into array
PBt=table2array(PBdailyt);
PBCO2=table2array(PBdailyCO2);
%index to extract outliers
idx = PBCO2 >=450 | PBCO2 <=300 ;
%set outliers equal to NaN
PBCO2(idx) = NaN;
This is my code so far, I am now looking to extract the seasonal cycle. The two different codes I have tried(below) has been unsuccessful. Is there another way I can go about removing the seasonal cycle?
[~,mo,~]=datevec(PBt);
%find the mean of the data
for k=1:12
PBCO2_mean(k) = mean(PBCO2(mo==k),'omitnan');
end
%subtract mean from data to remove seasonal cycle
for k = 1:12
PBCO2_deseasoned(mo==k) = PBCO2(mo==k) - PBCO2_mean(k);
end
and
[~,mo,~]=datevec(LJt);
%mean
PBCO2_mean=ones(12,1);
for i=1:12
idx=find(mo==i);
PBCO2_mean(i)=mean(PBCO2(idx),'omitnan');
end
%remove seasonal cycle
PBCO2_deseasoned=ones(636,1);
for i=1:12
PBCO2_deseasoned(mo==i)=PBCO2(mo==i)-PBCO2_s(i);
end

답변 (1개)

Star Strider
Star Strider 2021년 12월 7일
If the seasonal cycle is a narrow frequency band, and the data are sampled at consistent regular intervals, use a bandstop filter to remove it.
.

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by