A list,
1 Origin of Name
Gray Model was proposed by Professor Deng Julong in 1982.
Common system categories:
White system means that the internal characteristics of a system are completely known, that is, the information of the system is completely sufficient.
Black system means that the internal information of a system is unknown to the outside world and can only be observed and studied through its connection with the outside world.
One part of the information in the grey system is known, the other part is unknown, and there are uncertain relations among the factors in the system.
2 Algorithm Principle
Ii. Source code
clc; % screen clearing the clear; % delete memory close all; % close all Windows I_2=load('WUHAN PM2.5 data.txt'); % aviation fuel pump current (unit: A) % Liuliang=[0 2000 4000 6000 8000 10000 12000 14000 16000 18000];
% LL=0:600:18000;
% I1=interp1(Liuliang,I0,LL,'pchip');
% I=I1';
% I2=I1(1:14.3);
% I3=I1(1:14.4);
% I4=[I2',I3'];
% I_1=I4';
I_1=I_2+172; [a,b]=size(I_1); % calculates the row size of Ifor i=1: % b to calculate the original data sequence of a cumulative I_1_AGO (:, I) = cumsum (I_1 (: I)); end I_1_AGO; % sum sequence, ok [c,d]=size(I_1_AGO); % generate sequence Y Y =I_1(2:a,:);
Y=y;
beta=0.5; % is generally taken as0.5
for k=1:d % generates sequence Lfor j=2:c
l(j- 1,k)=(beta)*I_1_AGO(j,k)+(1-beta)*I_1_AGO(j- 1,k); % build next to mean end end l; [e,f]=size(l); l1=ones(e,1); Generate e * %1Of all the1Matrix L = [- L, l1]; % generate matrix B A1=inv(L'*L)*L'*Y; Two undetermined parameter matrices A and B of the n-element first-order differential equation are generated by the least square method, so as to whiten the original grey model A1=A1';
[g,h]=size(A1);
A=A1(:,1:h- 1); The development coefficient reflects the development trend of the predicted value series. Is negative (referring to the least square method of course), indicating exponential decay; Is positive, indicating that the index is rising). B=A1(:,end); Gray action (reflect the relationship between data changes and is the concrete embodiment of connotation and denotation, is the fundamental way to distinguish gray modeling and general modeling process). disp(['Development factor :',num2str(A)])
disp(['Grey action :',num2str(B)])
for k=0:a+1600% cumulative sequence predicted value II(k+1)=(I_1(1)-B/A)*exp(-A*k)+B/A; % Accumulative sequence In_1(k) after prediction by time response sequence- 1,:)=(expm(A*(k- 1))) * (L'+inv(A)*B)-inv(A)*B; end II; for kk=1:a+1600 yuce(kk)=II(kk+1)-II(kk); End yuce' end yuce'; % Simulation result %wucha(:,1)=I_1'-yuce; % % error Jieguo = [I_1, yuce',wucha(:,1)]; % [original data, simulation results, error] %ave=(sum(abs(wucha))/a)*100% Mean relative error x=1:a+1600;
hold on
box on
%grid on
plot(x(1:a),I_1,'k.-')
hold on
plot(x(1:a+1600),yuce,'b.-')
plot(35*ones(2500.1),'r-')
% plot(x,I_1,'k',x,yuce,'b') % drawing legend('Raw data'.'Forecast data'.'Final Year-end Mean concentration')
% title(Damage trend analysis of composite structures based on GM(1,1) model)
xlabel('Governance Duration/day');
ylabel('PM2.5');
xlim([1.2000]);
ylim([0.650]);
axis fill;
hold off
yucend=[280.0.0.0.0.0]'; For I = 1:1:5 yucend (I + 1, 1) = yuce (365 * I); data1=data(:,1)+171; qt=230; For at=qt:length(data)-1 at I=data1(w:at); [a,b]=size(I); % for I =1:b % I_1_AGO=cumsum(I); %cumsum(a) end I_1_AGO; % sum sequence, ok [c,d]=size(I_1_AGO); Y =I(2:a,:); % Take the original data from the second to form the Y matrix Y= Y; Beta = 0.5; Generally take 0.5 for k = 1: % d % L generated sequence for j = 2: L (j, k) = c (beta) * I_1_AGO (j, k) + (1 - beta) * I_1_AGO (j, k); end end l; % Calculate the adjacent mean value matrix 30 rows and 1 column [e,f]=size(l); l1=ones(e,1); % generate all 1 matrix L=[-l,l1]; % construct B matrix A1=inv(L'*L)*L'*Y; Two undetermined parameter matrices A and B of n-element first-order differential equation are generated by the least square method, so as to whiten the original grey model A1=A1';
[g,h]=size(A1)
A=A1(:,1:h- 1) % Extract the value of A and b % to obtain the development coefficient (which reflects the development trend of the predicted value series. Is negative (referring to the least square method of course), indicating exponential decay; Is positive, indicating that the index is rising). B=A1(:,end) % gray action (reflects the relationship between data changes and is the concrete embodiment of connotation and epitaxy, is the fundamental way to distinguish gray modeling from general modeling process). disp(['Development factor :',num2str(A)])
%Fazhanxishu=A
disp(['Grey action :',num2str(B)])
Huisezuoyongliang=B
for k=0: A % cumulative sequence predicted value II(k+1)=(I(1)-B/A)*exp(-A*(k))+B/A; % Accumulative sequence In_1(k) after prediction by time response sequence- 1,:)=(expm(A*(k- 1))) * (L'+inv(A)*B)-inv(A)*B; end II; % for kk=1:a yuce(kk+1)=II(kk+1) -ii (kk); End yuce1(w,:)=yuce; end yuce1(w,:)=yuce; w=w+1; end yuce1; Lyuce = [data1 (1, 1), yuce1 (1, 2: qt), yuce1 (1: length (data) - qt qt + 1) '];
[o,p]=size(lyuce);
wucha=data1-lyuce'; % % error Jieguo = [I lyuce, wucha (:1)]; % [Raw data, simulation results, error]Copy the code
3. Operation results
Fourth, note
Version: 2014 a
Complete code or ghostwrite plus 1564658423