Having an error using pacf function

Heres my code:
%code
clear all
clc
w=randn(10000,1);
num=[1, -1, 0.25];
y=filter(1,num,w);
pr=pacf(y,20,0);
stem(pr)
title('PACF of an AR(2) Process')

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 2 月 24 日

0 投票

pacf is not a function in MATLAB. It is a calculated result. See http://www.mathworks.com/help/econ/test-for-autocorrelation.html

6 件のコメント

LeBron
LeBron 2013 年 2 月 25 日
Sorry i dont understand what i am suppose to do? I dont have that sample data file in my examples folder as that link suggests
Walter Roberson
Walter Roberson 2013 年 2 月 25 日
That is an example that demonstrates the calculations. For you, if you assign your data to the variable "Y" then
pacf = parcorr(Y,20);
where the "20" is up to a lag of 20.
LeBron
LeBron 2013 年 2 月 25 日
so i still use my code that i posted above but just add the line u mentioned?
Walter Roberson
Walter Roberson 2013 年 2 月 25 日
I think for you it might be:
w=randn(10000,1);
num=[1, -1, 0.25];
y=filter(1,num,w);
parcorr(y,20);
title('PACF of an AR(2) Process')
That is, parcorr() that is not assigned to an output looks like it produces a stem plot.
Note: I do not have the appropriate toolbox to test with.
LeBron
LeBron 2013 年 2 月 25 日
Wow so parcorr() worked but its weird how pacf() doesnt work. Thanks a lot for your help
Walter Roberson
Walter Roberson 2013 年 2 月 25 日
There is no pacf() function in MATLAB or any of the toolboxes. You might perhaps have found a pacf() function somewhere else. pacf is returned by parcorr() if you assign it to a variable.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangePerformance and Memory についてさらに検索

タグ

質問済み:

2013 年 2 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by