How to forecastng in AR model
1 view (last 30 days)
Show older comments
Hi.guys.
I want to forecasting like this ↓
tic
data = iddata(sin(0.1*[1:100])',[]);
plot(data)
sys = ar(data,2);
K = 100;
p = forecast(sys,data,K);
plot(data,'b',p,'r'), legend('measured','forecasted')
toc
And I try this ↓
data = iddata(g_Fresult_data_4{1,1}(:,3),[]) ;
plot(data) ;
sys = ar(data,2);
K = 98 ;
p = forecast(sys,data,K);
plot(data,'b',p,'r'), legend('measured','forecasted')
g_Fresult_data_4{1,1}(:,3),[] is 98x7 double in 1x1 cell structure. (weather data)
WD WS T H HI UV AP
260.542 3.138 11.111 51.666 249.800 8.666 998.825
210.237 3.235 11.577 50.800 274.266 10.200 998.827
226.260 3.186 12.085 49.066 359.000 12.066 998.581
230.127 3.127 12.777 47.800 328.800 11.866 998.617
. . . . . . .
. . . . . . .
But plot is resulted below picture.
I do not know yet.. because it is the first time forecasting. I think 'sys=ar~' will be revised. help me.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154802/image.jpeg)
0 Comments
Answers (0)
See Also
Categories
Find more on Model Predictive Control Toolbox 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!