understanding forecasting code in matlab
2 views (last 30 days)
Show older comments
Below is the code attached for cost , pv and load from matab example file.
Can i know what method is used for forecasting and how can i compare forecasted values and initial values by plotting it both ?what is the code for poltting and comparing?
Construct forecast vectors for optimization (N x M) matrix
for i = 1:N
CostMat(i,:) = C(i:i+M-1);
PpvMat(i,:) = clearPpvVec(i:i+M-1);
PloadMat(i,:) = loadDataOpt(i:i+M-1,loadSelect);
end
CostForecast.time = tvec;
CostForecast.signals.values = CostMat;
CostForecast.signals.dimensions = M;
PpvForecast.time = tvec;
PpvForecast.signals.values = PpvMat;
PpvForecast.signals.dimensions = M;
PloadForecast.time = tvec;
PloadForecast.signals.values = PloadMat;
PloadForecast.signals.dimensions = M;
Answers (1)
Raunak Gupta
on 2 Oct 2020
Hi,
The default method used by the optimoptions mentioned in the code is linprog which is to solve linear programming problems.
You can see it by creating an optimization problem and displaying the optimoptions property.
prob = optimproblem;
prob.optimoptions
In the file energyOptimizationscript.m, the last part is for plotting the forecasted output. Similarly, you may also plot input data which is being loaded in the very first line. battSolarOptimize function explains the exact setup of optimization problem.
Hope it clarifies!
2 Comments
Raunak Gupta
on 3 Oct 2020
Hi,
Forecasting in essence means the same, like you want to predict the future data based on the past experience. So, the method by which the information is extracted from previous data is linear programming as mentioned in the answer. For the question of how, a model is fitted based on the data given and that model is used for generating output.
If the model is good in replicating then the forecasting will be good.
Hope this clarify the doubts!
See Also
Categories
Find more on Econometrics 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!