Getting Error while using Preparet. "Index exceeds matrix dimensions. Error in preparets (line 293) xi = xx(:,FBS+((1-net.numInputDelays):0));"
4 views (last 30 days)
Show older comments
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);
0 Comments
Answers (1)
rabi darji
on 3 Jul 2017
i need the answer too for that as i am facing same problem
1 Comment
Greg Heath
on 3 Jul 2017
Edited: Greg Heath
on 3 Jul 2017
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
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!