フィルターのクリア

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 Center および File ExchangePolynomials についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by