% This program is mainly used to calculate the predicted value of the model based on the gray theory.
% The applied mathematical model is GM (1, 1 ).
% The raw data processing method is an accumulation method. Y = input ('Enter the data'); % enter the data in the format shown in the example: [48.7 57.17 68.76 92.15]
N = length (y );
YY = ones (n, 1 );
YY (1) = y (1 );
For I = 2: N
Y (I) = YY (I-1) + Y (I );
End
B = ones (n-1, 2 );
For I = 1 :( N-1)
B (I, 1) =-(yy (I) + YY (I + 1)/2;
B (I, 2) = 1;
End
Bt = B ';
For j = 1: n-1
YN (j) = y (J + 1 );
End
YN = YN ';
A = inv (BT * B) * BT * YN;
A = A (1 );
U = a (2 );
T = u/;
T_test = input ('Enter the number of expected predictions :');
I = 1: t_test + N;
Yys (I + 1) = (Y (1)-T). * exp (-A. * I) + T;
Yys (1) = y (1 );
For J = N + t_test :-
YS (j) = yys (j)-yys (J-1 );
End
X = 1: N;
Xs = 2: N + t_test;
YN = ys (2: N + t_test );
Plot (X, Y, '^ R', xs, YN,' *-B ');
Det = 0;
For I = 2: N
Det = det + ABS (yn (I)-y (I ));
End
Det = det/(n-1 );
Disp (['absolute percentage error: ', num2str (DET),' % ']);
Disp (['predicted value: ', num2str (YS (n + 1: N + t_test)]);