Time Difference and adftest (augmented dickey fuller test)

Hello Pals,
I'm trying to run the given script but there is an error.
I'm using function[h,pvalue]=adftest.
If I'm using adftest with T, it gives me logic h=0( since time is non stationary). Therefore to ake time stationary I did detrended T to dt.
But,then my Udays goes to 0, due to which my for loop becomes false. and give me error. I have attached the excel file for the reference.
Thanks
clc; clear; close all;
[num,txt,raw]=xlsread('CHCP Loads.xlsx','Heating Load');
qHtg=num(:,end);
T =datenum(txt(2:end,1)); % given Time
dt=diff(T,1);
Udays=unique(round(dt));
for i= 1:5
ind= round(dt)==Udays(i);
peakHtg(i,1)=max(qHtg(ind));
end
[h,pval]=adftest(peakHtg);
%h=0 so we need to do the differncing
close all

Answers (0)

Categories

Asked:

on 14 Mar 2019

Community Treasure Hunt

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

Start Hunting!