필터 지우기
필터 지우기

Please expalin the error

조회 수: 1 (최근 30일)
dav
dav 2013년 3월 2일
Hi ,
for the data set y, I need to fit an ar model and calculate the best order using aic.
I used the following code to do that:
V = arxstruc(y,struc(1:15));
m = selstruc(V,'aic');
However, I got the following error when I tried to run it.
Error using struc (line 21)
Not enough input arguments.
Error in big100 (line 47)
V = arxstruc(y,struc(1:15));
Can someone correct this please?
Full code:
clc;
clear;
a0 = 0.05; a1 = 0.1; b1 = 0.85;
epsi=zeros(3000,1);
simsig=zeros(3000,1);
for i = 1:3000
if (i==1)
simsig(i) = a0 ;
s=(simsig(i))^0.5;
epsi(i) = normrnd(0,1) * s;
else
simsig(i) = a0+ a1*(epsi(i-1))^2+ b1*simsig(i-1);
s=(simsig(i))^0.5;
epsi(i) = normrnd(0,1) * s;
end
end
yt1=epsi.^2;
y = yt1(2001:3000);
V = arxstruc(y,struc(1:15));
m = selstruc(V,'aic');

채택된 답변

Brian B
Brian B 2013년 3월 2일
The documentation for struc indicates that it takes three input arguments:
>>help struc
struc Generate typical structure matrices for ARXSTRUC and IVSTRUC.
NN = struc(NA,NB,NK)
NA, NB and NK are vectors containing the orders na, nb and delays nk
to be tested. See help on ARX for an explanation of na, nb and nk.
NN is returned as a matrix containing all possible combinations of these
orders and delays.
...
But you have called it with only one vector (1:15). You need to choose values for nb and nk to test as well.
  댓글 수: 3
Brian B
Brian B 2013년 3월 2일
The same error? If I enter
struc(1:15, 1:15, 1:15)
I get a matrix whose rows are of the form (na, nb, nk). It is not surprising if you still get an error, though, since your calling syntax for arxstruc does not look right either.
Type
help arxstruc
to see how to correct that.
Brian B
Brian B 2013년 3월 2일
편집: Brian B 2013년 3월 2일
There are two datasets (denoted ZE and ZV in the documentation) and one matrix of orders (denoted NN). The matrix of orders is what you get from struc. The two datasets are used for estimation (ZE) and validation (ZV). Note that these are not just vectors, they are IDDATA objects.
Once more:
help iddata
If you want to use the same data for both, pass it in twice.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Input-Output Polynomial Models에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by