step ahead prediction of a non-linear model
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear All,
I am currently using the non linear ARX estimation tool to model an input/output system, the input and ouput are vectors and the lenght of the sample is 8760. I created the model with an accuracy of about 95 %. The next step is to create a 10000 point step ahead prediction of the output. I chose the prediction option in the model ouput plot figure and i chose the prediction horizon to be 10000 points but unfortunalty i experienced no change in the output i.e. the graph produced remained similar to the graph of the simulated model. I then tried doing so using the command predict an error arises stating that the 'predict command could not be used for such data type'. I would be greatful if someone could inform if there someting i am missing or if i could use any other command or tool to do so.
Thank you for your time..
0 Kommentare
Akzeptierte Antwort
Rajiv Singh
am 6 Jun. 2011
PREDICT function is the closest one you would use for predicting the output of a model N steps into future. The limitation is that it would perform prediction only for the duration of the input data. That is, if you provide input data for the time range 0-10 seconds, the returned output would be the predicted response in the same 0-10 seconds time span. Of course, to compute the predicted response at a time instant t, the function would use only the past measured values of the output (y(t-1), y(t-2),.. etc) and all the available inputs (u(t), u(t-1), u(t-2), ... etc) (that is, it will not "look ahead" at measured output values for prediction).
What you are looking for is a "forecasting" function which will predict the model's response into unseen future (beyond the samples for which the data is available). System Identification Toolbox currently does not offer that. But if performance (speed of execution) is not an issue, you can achieve this via successive calls to PREDICT as follows:
1. Figure out what the "future input values" you would like to use first. Even though you are forecasting output values, you will need to know what the input values would be at those future time instants. This of course does not apply if you have a time series model (no measured input signals). Let us call these values "ufuture".
2. Initialize variable that will hold the desired response.
forecast_response = zeros(0, size(model,1));
3. To your I/O data (say, "data"), add one sample with output value 0 and input value ufuture(1):
[~, ny, nu] = size(data); data2 = iddata([data.y; zeros(1, ny)], [data.u; ufuture(1,:)])
4. Call the PREDICT command using the new data2. Use 1 as prediction horizon even if you want to do an arbitrary N-step ahead forecasting (this is because we will achieve N-step ahead forecasting by N 1-step ahead successive predictions):
yp = predict(model, data2, 1);
5. Cache the "forecasted" value: forecast_response(end+1,:) = yp.y(end,:);
6. Update the last output sample value in data2 to the last sample of predicted response yp:
data2.y(end,:) = forecast_response(end,:);
7. Repeat steps 3 to 6. In step 3, use ufuture(i) where i is the iteration number. Also, to avoid the size of data growing over iterations, you can remove the starting 1 sample every time you append one new sample to the end of data.
For linear models, something more efficient can be done; the N calls to PREDICT can be avoided. Let me know if you need a forecasting function for linear models.
2 Kommentare
Rajiv Singh
am 20 Jul. 2011
Yes, you can use predict, but it would give you results only for the time span of the measured data. If you need to forecast an arbitrary N steps into future you need something else: either use the above "calling predict in a loop" strategy or write a forecasting function. Let me know if you need help (better to start a new thread )
Weitere Antworten (1)
Mario
am 22 Jul. 2011
Dear Rajiv,
I think that everybody that are interested in system identification can appreciate if you upload a function for forecast an arbitrary N steps into future. I opened a topic today about a function that I modified but now I need to improve it.
Thank you
0 Kommentare
Siehe auch
Kategorien
Mehr zu Nonlinear ARX Models finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!