当前位置:网站首页>Matlab tips (27) grey prediction
Matlab tips (27) grey prediction
2022-07-06 22:39:00 【mozun2020】
MATLAB Tips (27) Grey prediction
Preface
MATLAB Learning about image processing is very friendly , You can start from scratch , There are many encapsulated functions that can be called directly for basic image processing , This series of articles is mainly to introduce some of you in MATLAB Some concept functions are commonly used in routine demonstration !
Color prediction model is through a small amount of 、 Incomplete information , A prediction method of establishing a mathematical model to make a prediction . It is based on the past and present development laws of objective things , With the help of scientific methods, describe and analyze the future development trend and situation , And form scientific assumptions and judgments .
It is a method to predict the system with uncertain factors . Grey prediction identifies the difference of development trend between system factors , That is, correlation analysis , And generate and process the original data to find the law of system change , Generate data sequences with strong regularity , Then the corresponding differential equation model is established , So as to predict the future development trend of things . The grey prediction model is constructed by a series of quantitative values reflecting the characteristics of the prediction object observed at the same time interval , Predict the characteristic quantity at a certain time in the future , Or the time to reach a characteristic quantity .
The example encountered when searching for data , Here to share ,MATLAB Version is MATLAB2015b.
One . MATLAB Simulation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function : Grey prediction program
% Environmental Science :Win7,Matlab2015b
%Modi: C.S
% Time :2022-06-27
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% I. Clear environment variables
clear all
clc
tic
%Matlab Grey prediction program :
%y=input(' Please input data ');
y=[29.8 30.11 41.05 70.12 77.79 77.79 104.82 65.22 82.7 100.79]
n=length(y);
yy=ones(n,1);
yy(1)=y(1);
for i=2:n
yy(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/a;
t_test=input(' Enter the number to be predicted ');
i=1:t_test+n;
yys(i+1)=(y(1)-t).*exp(-a.*i)+t;
yys(1)=y(1);
for j=n+t_test:-1:2
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([' The percent absolute error is :',num2str(det),'%']);
disp([' Predictive value for :',num2str(ys(n+1:n+t_test))]);
% Please input data [29.8 30.11 41.05 70.12 77.79 77.79 104.82 65.22 82.7 100.79]
toc
Two . Simulation results
y =
29.8000 30.1100 41.0500 70.1200 77.7900 77.7900 104.8200 65.2200 82.7000 100.7900
yy =
29.8000
59.9100
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
yy =
29.8000
59.9100
100.9600
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
yy =
29.8000
59.9100
100.9600
171.0800
1.0000
1.0000
1.0000
1.0000
1.0000
1.0000
yy =
29.8000
59.9100
100.9600
171.0800
248.8700
1.0000
1.0000
1.0000
1.0000
1.0000
yy =
29.8000
59.9100
100.9600
171.0800
248.8700
326.6600
1.0000
1.0000
1.0000
1.0000
yy =
29.8000
59.9100
100.9600
171.0800
248.8700
326.6600
431.4800
1.0000
1.0000
1.0000
yy =
29.8000
59.9100
100.9600
171.0800
248.8700
326.6600
431.4800
496.7000
1.0000
1.0000
yy =
29.8000
59.9100
100.9600
171.0800
248.8700
326.6600
431.4800
496.7000
579.4000
1.0000
yy =
29.8000
59.9100
100.9600
171.0800
248.8700
326.6600
431.4800
496.7000
579.4000
680.1900
Enter the number to be predicted 6
The percent absolute error is :14.5128%
Predictive value for :110.5718 120.8171 132.0116 144.2434 157.6086 172.2122
Time has passed 1.866326 second .
3、 ... and . Summary
Gray scale prediction in prediction application , Such as weather forecast 、 earthquake prediction 、 Pest forecast, etc , Domestic scholars have made many useful studies . Simply take a note of the example of gray prediction analysis , It may be used later . Learn one every day MATLAB Little knowledge , Let's learn and make progress together !
边栏推荐
猜你喜欢
网络基础入门理解
Aardio - integrate variable values into a string of text through variable names
Financial professionals must read book series 6: equity investment (based on the outline and framework of the CFA exam)
[leetcode] 19. Delete the penultimate node of the linked list
Advantages of link local address in IPv6
Sword finger offer question brushing record 1
View
剪映+json解析将视频中的声音转换成文本
LeetCode 练习——剑指 Offer 26. 树的子结构
Netxpert xg2 helps you solve the problem of "Cabling installation and maintenance"
随机推荐
柔性数组到底如何使用呢?
Improving Multimodal Accuracy Through Modality Pre-training and Attention
Advantages of link local address in IPv6
CocosCreator+TypeScripts自己写一个对象池
手写ABA遇到的坑
Use ECs to set up an agent
Netxpert xg2 helps you solve the problem of "Cabling installation and maintenance"
关于声子和热输运计算中BORN电荷和non-analytic修正的问题
Windows Auzre 微软的云计算产品的后台操作界面
项目复盘模板
OpenCV VideoCapture. Get() parameter details
剪映+json解析将视频中的声音转换成文本
Puppeter connects to the existing Chrome browser
go多样化定时任务通用实现与封装
第十九章 使用工作队列管理器(二)
MySQL----初识MySQL
pytorch_YOLOX剪枝【附代码】
基于 QEMUv8 搭建 OP-TEE 开发环境
MySQL教程的天花板,收藏好,慢慢看
How to confirm the storage mode of the current system by program?