Question regarding executing auto-correlation

Hi all,
I have to stationarized my data using auto-correlation to be used in arima models. However, i have trouble getting the codes correct.
data = xlsread('20jun.xlsx');
pv = data; %144 readingfrom 20jun
t= [1:144]; %defined time points
plot(t,pv);
I have 144 data readings, resulting in 144 time point. Any advise will be appreciated. Thanks for the time.

2 个评论

What exactly is the problem with your code?
Hi Mischa,
Thanks for taking the time to reply. The error i obtained is 'Vectors must be the same lengths'. Pardon my raw knowledge regarding matlab, but is it necessary to use an arima model to do acf? Thanks in advance.

请先登录,再进行评论。

 采纳的回答

Before plot, put there lines and tell us what it says
size(t) % Don't use a semicolon
size(pv) % Don't use a semicolon
class(t) % Don't use a semicolon
class(pv) % Don't use a semicolon
And I don't see any autocorrelation going on, just reading data from a workbook and plotting it.

5 个评论

Hi image analyst,
Thank you for taking time to read my post. Let me rephrase my poor post. I have these 144 readings(pv), and i need 144 time points to plot them. 1 time point to 1 pv reading.
size(t) is 1 144
size(pv) is 144 1
class(t,pv) are double.
I have actually tried using just one line, together with the above codes;
autocorr(pv)
which I doubt is correct, since the graph only showed 21 timepoints. Is there anyway I can rectify my codes?
Try plot (t', pv) and try xcorr() with the 'coeffs' option. Look at the example in the help for xcorr for autocorrelation.
Hi Image analyst,
Thanks for your input.
My codes are:.
x = xlsread('20jun.xlsx'); %144 readingfrom 20jun
t= [1:144]; %defined time points
plot(t,x);
figure;
[xc,lags] = xcorr(x,'coeff');
stem(lags,xc)
Is this acceptable? Sorry for my limited knowledge on matlab.
I don't know. I don't have your data. Can't you tell if it works or not? Do you get the expected results?
Hi Image analyst,
I think it works. Thank you so much for your advises. You have been a great help.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by