How to predict step ahead/future values by applying moving average?
3 次查看(过去 30 天)
显示 更早的评论
I have used moving average for prediction as code is shown below.Now based on window/period i want to predict values for future.
For instance if there are total 180 rows in excel sheet i want to predict next /future rows with window or time interval of 7.I have done this in excel as shown in figure but i want to implement same in MATLAB.
clc
clear all
data=xlsread ('2.xlsx','C:C');
% A = [4 8 6 -1 -2 -3 -1 3 4 5];
% M = movmean(data3,2)
%%
period=7;
out = filter(ones(1,period),period,data);
%Now i want to predict step ahead as per values of period
0 个评论
回答(1 个)
Harshit Jain
2019-3-5
My assumption is that you want to predict values of future rows for which data is not there.
By carefully looking at excel prediction which you have attached above, you can see that excel just takes window of size = window_length - total_values_not_present and takes moving average of that for predicting future values. For e.g., If you add last six values and divide by 6 you'll get 228.0098, taking last 5 values and dividing by 5 gives you 247.00222, and so on.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Manage System Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!