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