Please expalin the error
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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');
0 comentarios
Respuesta aceptada
Brian B
el 2 de Mzo. de 2013
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 comentarios
Brian B
el 2 de Mzo. de 2013
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
el 2 de Mzo. de 2013
Editada: Brian B
el 2 de Mzo. de 2013
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.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!