Getting Error while using Preparet. "Index exceeds matrix dimensions. Error in preparets (line 293) xi = xx(:,FBS+(​(1-net.num​InputDelay​s):0));"

조회 수: 3 (최근 30일)
My code is
clc
clear all
filename = 'input_import2.xlsx'
x = xlsread(filename);
filename = 'input_ex_cog_import_export2.xlsx'
t = xlsread(filename);
size(x)
size(t)
setdemorandstream(491218381)
net = narxnet(1:2,1:2,10);
view(net)
[Xs,Xi,Ai,Ts] = preparets(net,x,{},t);
[net,tr] = train(net,Xs,Ts,Xi,Ai);
nntraintool
plotperform(tr)
Y = net(Xs,Xi,Ai);
perf = mse(net,Ts,Y)
plotresponse(Ts,Y)
E = gsubtract(Ts,Y);
ploterrcorr(E)
net2 = closeloop(net);
view(net)
[Xs,Xi,Ai,Ts] = preparets(net2,x,{},t);
Y = net2(Xs,Xi,Ai);
plotresponse(Ts,Y)
net3 = removedelay(net);
view(net)
[Xs,Xi,Ai,Ts] = preparets(net3,x,{},t);
Y = net3(Xs,Xi,Ai);
plotresponse(Ts,Y)
and output is
ns =
1 321
ans =
1 321
Index exceeds matrix dimensions.
Error in preparets (line 293)
xi = xx(:,FBS+((1-net.numInputDelays):0));
Error in mycode4 (line 12)
[Xs,Xi,Ai,Ts] = preparets(net,x,{},t);

답변 (1개)

rabi darji
rabi darji 2017년 7월 3일
i need the answer too for that as i am facing same problem
  댓글 수: 1
Greg Heath
Greg Heath 2017년 7월 3일
편집: Greg Heath 2017년 7월 3일
You are using the same notation for open loop and close loop ...ARRRRGGGGHHHH
What are the matrix and cell sizes of inputs x & X = cell(x)and targets t & T = cell(t). They are not necessarily the same !
The following tends to make life less frustrating for others:
1. Lower case reals and UPPER CASE CELLS
2. Noting sizes with % comments, e.g.,
[ Im N ] = size(x) % [ 3 100 ] "m" ==> matrix
[ I N ] = size(X) % [ 1 100 ]
3. Subcripts o and c for openloop and closeloop, respectively
Hope this helps.
Greg

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

Community Treasure Hunt

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

Start Hunting!

Translated by