Anyone can rectity the given below error?
4 views (last 30 days)
Show older comments
%%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);
0 Comments
Answers (1)
Walter Roberson
on 25 Mar 2018
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.
0 Comments
See Also
Categories
Find more on Signal Analysis 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!