Filter löschen
Filter löschen

step ahead prediction of a non-linear model

1 Ansicht (letzte 30 Tage)
Mohamed Hussain
Mohamed Hussain am 4 Jun. 2011
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..

Akzeptierte Antwort

Rajiv Singh
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
Mohamed Hussain
Mohamed Hussain am 10 Jun. 2011
Dear Rajiv
Thank you for your answer it really helped. I am using a time series model, so as you said i can't predict the input's behaviour in the future. I am sorry i did not provide a clear explaination of what i am doing. The input is the hourly wind speed for a one year period and the output is caculated using a set of a equations using these wind speed values, and thus i can't predict how the wind speed will change further beyond the vaues i have.
I think i would rather use the time series modeling to model the predicted response of the wind speed for the sample period availble and then use this model to forcast the response for defined period in the future, so if i use a linear model for example (armax or ar)can i use time as an input and use the predict command ?
Again thank you very much for your kind support...
Rajiv Singh
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 )

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Mario
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

Community Treasure Hunt

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

Start Hunting!

Translated by