Getting Error while using Preparet. "Index exceeds matrix dimensions. Error in preparets (line 293) xi = xx(:,FBS+((1-net.numInputDelays):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);
댓글 수: 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에서 Modeling and Prediction with NARX and Time-Delay Networks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!