Getting Error while using Preparet. "Index exceeds matrix dimensions. Error in preparets (line 293) xi = xx(:,FBS+((1-net.numInputDelays):0));"
1 次查看(过去 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);
0 个评论
回答(1 个)
rabi darji
2017-7-3
i need the answer too for that as i am facing same problem
1 个评论
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!