Anyone can rectity the given below error?

조회 수: 1 (최근 30일)
Manoj
Manoj 2018년 3월 24일
답변: Walter Roberson 2018년 3월 25일
%%Wavelet decomposition
s =xlsread('ARIMA_data.xls');
% Time series to be decomposed
l_s = length(s);
lag=15;
l=l_s;
% [C,L] = wavedec(s,3,'db1');
cA=zeros(l_s/2,10);
cD=zeros(l_s/2,10,10);
D=zeros(l_s,10,10);
A=zeros(l_s,10);
for i=1:10
clear input
% i=6;
[C,L] = wavedec(s,i,'db5'); % Wavelet family; problem specific
ca=appcoef(C,L,'db5',i);
pp=size(ca);
cA(1:pp(1,1),i)=ca;
clear ca;
clear pp;
A(:,i)= wrcoef('a',C,L,'db5',i);
for j=1:i
cd=detcoef(C,L,j);
qq=size(cd);
cD(1:qq(1,1),i,j)= cd;
clear cd;
clear qq;
D(:,i,j) = wrcoef('d',C,L,'db5',j);
input(:,j)= D(:,i,j);
%
end
input(:,j+1)=A(:,i);
ii=size(input);
input=input(1:(ii(1,1)-lag-1),:);
clear ii;
input=input';
t=s(2+lag:l_s);
t=t';
for h=1:15
for trial=1:5
net = feedforwardnet(h,'trainlm');
net.divideFcn = 'divideblock'; % Divide data randomly
% net.divideMode = 'time'; % Divide up every value
net.inputs{1}.processFcns = {'removeconstantrows'};
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 5/100;
net.divideParam.testRatio = 25/100;
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'purelin';
net.performFcn = 'mse'; % Mean squared error
net.trainParam.showWindow = 0;
[tNet,tr] = train(net,input,t);
output = tNet(input);
test_t = t(tr.testInd);
test_output = output(tr.testInd);
net.performFcn = 'mse';
perf=perform(tNet,test_t,test_output);
perfR=corrcoef(test_t,test_output);
arc(h,trial,i)=perf;
arcR(h,trial,i)=perfR(1,2);
end
end
clear input
end
Subscripted assignment dimension mismatch.
Error in WNN_RGMatlab (line 24)
A(:,i)= wrcoef('a',C,L,'db5',i);

답변 (1개)

Walter Roberson
Walter Roberson 2018년 3월 25일
You can't get that far with that data. Your s is 1633 x 3, and you pass s into wavedec, but wavedec requires that a vector be passed in. You need to extract column 3 from the data and work with that.
With that change, I do not encounter any subscript error.
The final output variables have no obvious meaning, but that is a different matter.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by