필터 지우기
필터 지우기

Subscript indices must either be real positive integers or logicals.

조회 수: 1 (최근 30일)
The code is:
%%%NARX code %% 1. Importing data
load input; load target; % %%S = load('magdata'); % %%X = con2seq(S.u); % %%T = con2seq(S.y); % To scale the data it is converted to its log value:
%loginput = log(input); % logtarget = log(target); % X = tonndata(loginput,false,false); % T = tonndata(logtarget,false,false); X = con2seq(input); T = con2seq(target); %% 2. Data preparation N = 15; % Multi-step ahead prediction % Input and target series are divided in two groups of data: % 1st group: used to train the network
inputSeries = X(1:end-N); targetSeries = T(1:end-N); % 2nd group: this is the new data used for simulation. inputSeriesVal will % be used for predicting new targets. targetSeriesVal will be used for % network validation after prediction inputSeriesVal = X(end-N+1:end); targetSeriesVal = T(end-N+1:end);% This is generally not available
%% 3. Network Architecture delay = 2; neuronsHiddenLayer = 50; % Network Creation net = narxnet(1:delay,1:delay,neuronsHiddenLayer); %% 4. Training the network [Xs,Xi,Ai,Ts] = preparets(net,inputSeries,{},targetSeries); net = train(net,Xs,Ts,Xi,Ai); view(net) Y = net(Xs,Xi,Ai); % Performance for the series-parallel implementation, only % one-step-ahead prediction perf = perform(net,Ts,Y); %% 5. Multi-step ahead prediction inputSeriesPred = [inputSeries(end-delay+1:end),inputSeriesVal]; targetSeriesPred = [targetSeries(end-delay+1:end), con2seq(nan(1,N))]; netc = closeloop(net); view(netc) [Xs,Xi,Ai,Ts] = preparets(netc,inputSeriesPred,{},targetSeriesPred); yPred = netc(Xs,Xi,Ai); perf = perform(net,yPred,targetSeriesVal); figure; plot([cell2mat(targetSeries),nan(1,N); nan(1,length(targetSeries)),cell2mat(yPred); nan(1,length(targetSeries)),cell2mat(targetSeriesVal)]') legend('Original Targets','Network Predictions','Expected Outputs')
  댓글 수: 2
David Young
David Young 2015년 3월 11일
As you can see yourself, the code isn't readable, so you are unlikely to get an answer. You can fix this using the "{} Code" button.
You should also include a statement of what the problem is and which line of code produces an error message.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2015년 3월 11일

추가 답변 (1개)

Deep Gogoi
Deep Gogoi 2015년 3월 16일
I have enclosed my .m file . I can't remove the error at line number 29. The error is
" Subscript indices must either be real positive integers or logicals.
Error in ==> rainfall at 29 inputSeriesVal = X(end-N+1:end);
"

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by