当前位置:网站首页>MATLAB小技巧(27)灰色预测
MATLAB小技巧(27)灰色预测
2022-07-06 15:32:00 【mozun2020】
MATLAB小技巧(27)灰色预测
前言
MATLAB进行图像处理相关的学习是非常友好的,可以从零开始,对基础的图像处理都已经有了封装好的许多可直接调用的函数,这个系列文章的话主要就是介绍一些大家在MATLAB中常用一些概念函数进行例程演示!
色预测模型是通过少量的、不完全的信息,建立数学模型做出预测的一种预测方法。是基于客观事物的过去和现在的发展规律,借助于科学的方法对未来的发展趋势和状况进行描述和分析,并形成科学的假设和判断。
它是一种对含有不确定因素的系统进行预测的方法。灰色预测通过鉴别系统因素之间发展趋势的相异程度,即进行关联分析,并对原始数据进行生成处理来寻找系统变动的规律,生成有较强规律性的数据序列,然后建立相应的微分方程模型,从而预测事物未来发展趋势的状况。其用等时距观测到的反映预测对象特征的一系列数量值构造灰色预测模型,预测未来某一时刻的特征量,或达到某一特征量的时间。
搜寻资料的时候遇到的这个示例,这里分享给大家,MATLAB版本为MATLAB2015b。
一. MATLAB仿真
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%功能:灰色预测程序
%环境:Win7,Matlab2015b
%Modi: C.S
%时间:2022-06-27
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% I. 清空环境变量
clear all
clc
tic
%Matlab的灰色预测程序:
%y=input('请输入数据');
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('输入需要预测的个数');
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(['百分绝对误差为:',num2str(det),'%']);
disp(['预测值为:',num2str(ys(n+1:n+t_test))]);
%请输入数据 [29.8 30.11 41.05 70.12 77.79 77.79 104.82 65.22 82.7 100.79]
toc
二. 仿真结果
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
输入需要预测的个数6
百分绝对误差为:14.5128%
预测值为:110.5718 120.8171 132.0116 144.2434 157.6086 172.2122
时间已过 1.866326 秒。
三. 小结
灰度预测在预测应用上,如气象预报、地震预报、病虫害预报等,国内学者做出了许多有益的研究。简单对灰度预测分析实例做一个笔记,后期可能会用到。每天学一个MATLAB小知识,大家一起来学习进步阿!
边栏推荐
- Jafka来源分析——Processor
- 2022-07-05 stonedb的子查询处理解析耗时分析
- MySQL ---- first acquaintance with MySQL
- Chapter 3: detailed explanation of class loading process (class life cycle)
- 2014 Alibaba web pre intern project analysis (1)
- Gd32f4xx serial port receive interrupt and idle interrupt configuration
- Memorabilia of domestic database in June 2022 - ink Sky Wheel
- 【无标题】
- 剪映+json解析将视频中的声音转换成文本
- Sword finger offer question brushing record 1
猜你喜欢
Leetcode exercise - Sword finger offer 26 Substructure of tree
Attack and defense world miscall
Unity3d minigame unity webgl transform plug-in converts wechat games to use dlopen, you need to use embedded 's problem
基於 QEMUv8 搭建 OP-TEE 開發環境
剪映+json解析将视频中的声音转换成文本
如何用程序确认当前系统的存储模式?
重磅新闻 | Softing FG-200获得中国3C防爆认证 为客户现场测试提供安全保障
Mysql database basic operations DML
每日一题:力扣:225:用队列实现栈
rust知识思维导图xmind
随机推荐
Lora sync word settings
0 basic learning C language - digital tube
MySQL----初识MySQL
Aardio - 不声明直接传float数值的方法
剑指offer刷题记录1
在IPv6中 链路本地地址的优势
NetXpert XG2帮您解决“布线安装与维护”难题
NPDP certification | how do product managers communicate across functions / teams?
leetcode:面试题 17.24. 子矩阵最大累加和(待研究)
HDR image reconstruction from a single exposure using deep CNN reading notes
HDU 5077 NAND (violent tabulation)
OpenNMS分离数据库
【LeetCode】19、 删除链表的倒数第 N 个结点
UDP programming
Applet system update prompt, and force the applet to restart and use the new version
【编译原理】做了一半的LR(0)分析器
12、 Start process
Daily question 1: force deduction: 225: realize stack with queue
新手程序员该不该背代码?
uniapp滑动到一定的高度后固定某个元素到顶部效果demo(整理)