필터 지우기
필터 지우기

Quadratic time detrending. Any help or code ???

조회 수: 2 (최근 30일)
Panty
Panty 2014년 7월 15일
댓글: Panty 2014년 7월 15일
Hi guys!! I have a question.
For linearly detrending a time-series you can use the detrend(..) function.
If you want to extract the quadratic time trend?? Any function or code you could share??
I have found this code in the 'Parametric Trend Estimation' Mathworks page, but I want to make sure whether it works or not and you opinion.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load(fullfile(matlabroot,'examples','econ','Data_Accidental.mat')); t = [1:N]'; X = [ones(N,1) t t.^2];
B = X\Y;
Th = X*B;
h = plot(Th/1000,'r','LineWidth',2);
legend(h,'Quadratic Trend Estimate');
hold off
Y = Dataset.NUMD;
N = length(Y);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Many thanks

채택된 답변

Alfonso Nieto-Castanon
Alfonso Nieto-Castanon 2014년 7월 15일
Yes, that should work, you just need to define:
Ynew = Y - Th;
to get the new "detrended" timeseries.
  댓글 수: 7
Alfonso Nieto-Castanon
Alfonso Nieto-Castanon 2014년 7월 15일
Yes, ordinary least squares, linear regression, general linear model, the X\Y part would do just that.
Panty
Panty 2014년 7월 15일
Thats perfect. Thank you very much Alfonso. Much appreciated.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation and Preprocessing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by