当前位置:网站首页>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 !
边栏推荐
- Daily question 1: force deduction: 225: realize stack with queue
- 2022-07-05 使用tpcc对stonedb进行子查询测试
- Leetcode: interview question 17.24 Maximum cumulative sum of submatrix (to be studied)
- Aardio - Method of batch processing attributes and callback functions when encapsulating Libraries
- Export MySQL table data in pure mode
- Adavit -- dynamic network with adaptive selection of computing structure
- NPDP认证|产品经理如何跨职能/跨团队沟通?
- MySQL ---- first acquaintance with MySQL
- UVa 11732 – strcmp() Anyone?
- 雅思口语的具体步骤和时间安排是什么样的?
猜你喜欢
Heavyweight news | softing fg-200 has obtained China 3C explosion-proof certification to provide safety assurance for customers' on-site testing
The SQL response is slow. What are your troubleshooting ideas?
金融人士必读书籍系列之六:权益投资(基于cfa考试内容大纲和框架)
Aardio - does not declare the method of directly passing float values
Web APIs DOM 时间对象
Leetcode exercise - Sword finger offer 26 Substructure of tree
Advantages of link local address in IPv6
(十八)LCD1602实验
Config:invalid signature solution and troubleshooting details
视图(view)
随机推荐
Jafka来源分析——Processor
volatile关键字
hdu 5077 NAND(暴力打表)
[IELTS speaking] Anna's oral learning record part1
2022-07-05 使用tpcc对stonedb进行子查询测试
UVa 11732 – strcmp() Anyone?
extern关键字
What are the interface tests? What are the general test points?
MySQL ---- first acquaintance with MySQL
Unified Focal loss: Generalising Dice and cross entropy-based losses to handle class imbalanced medi
Sword finger offer question brushing record 1
memcached
GD32F4XX串口接收中断和闲时中断配置
Traversal of a tree in first order, middle order, and then order
CocosCreator+TypeScripts自己写一个对象池
Use ECs to set up an agent
Netxpert xg2 helps you solve the problem of "Cabling installation and maintenance"
void关键字
POJ 1258 Agri-Net
网络基础入门理解