# How can I use neural network time series toolbox to actually make predicts?

조회 수: 19(최근 30일)
Evan John 2017년 5월 1일
댓글: Muhammad Usman Saleem 2023년 5월 14일 10:30
Hello,
I am trying to train a neural network to make predictions about the trajectory of a ball. So I have an excel spreadsheet with about 20 trajectories (time, x, y, z for each of them) and I am trying to train it so that it can predict an entire trajectory based upon the initial condition given to it (initial time is 0 for all of them, as is initial x since they are all starting at the same spot).
I have been doing the following :
nnstart --> Time Series App --> Nar --> Load data --> train.
I create the Matlab Matrix only function and then the simple script. But how can I actually use this to make predictions? All of the manuals and tutorials are very vague at this part. They pretty much show you how to train it and validate that it works on data it hasn't seen, but doesn't actually tell you how to use it to make predictions, even in the examples that it gives. Ideally I would like to give it the initial state (time = 0, x = 0, y = y0, z = z0) and then it populates the rest of the trajectory until it reaches x=10. I can give it data for delay states if needed
Thank you so much!
##### 댓글 수: 1표시 없음숨기기 없음
Greg Heath 2017년 5월 2일
Insufficient information.
Greg

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

### 답변(1개)

Sanjana Ramakrishnan 2017년 5월 3일
Refer the below example code for predicting using Neural Network:
1) Load the simple time-series prediction data and create a NAR network.
T = simplenar_dataset;
net = narnet(1:2,10);
2)Prepare the time series data using preparets and train the network:
[Xs,Xi,Ai,Ts] = preparets(net,{},{},T);
net = train(net,Xs,Ts,Xi,Ai);
view(net)
3)Calculate the network performance.
[Y,Xf,Af] = net(Xs,Xi,Ai);
perf = perform(net,Ts,Y)
4)To predict the output for the next 20 time steps, first simulate the network in closed loop form.
[netc,Xic,Aic] = closeloop(net,Xf,Af);
view(netc)
5)To simulate the network 20 time steps ahead, input an empty cell array of length 20. The network requires only the initial conditions given in Xic and Aic.
y2 = netc(cell(0,20),Xic,Aic)
##### 댓글 수: 2표시 이전 댓글 수: 1숨기기 이전 댓글 수: 1
Muhammad Usman Saleem 2023년 5월 14일 10:30
Have you find solution to predict fututre values?

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

### 범주

Find more on Sequence and Numeric Feature Data Workflows 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!