How to predict step ahead/future values by applying moving average?

조회 수: 2 (최근 30일)
Ali
Ali 2019년 2월 25일
답변: Harshit Jain 2019년 3월 5일
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

답변 (1개)

Harshit Jain
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.

카테고리

Help CenterFile Exchange에서 Manage System Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by