【时间序列预测】基于matlab LMS麦基玻璃时间序列预测【含Matlab源码 1443期】
一、获取代码方式
获取代码方式1:
通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。
获取代码方式2:
通过紫极神光博客主页开通CSDN会员,凭支付凭证,私信博主,可获得此代码。
获取代码方式3:
完整代码已上传我的资源:【时间序列预测】基于matlab LMS麦基玻璃时间序列预测【含Matlab源码 1443期】
备注:开通CSDN会员,仅只能免费获得1份代码(有效期为开通日起,三天内有效);
订阅紫极神光博客付费专栏,可免费获得2份代码(有效期为订阅日起,三天内有效);
二、部分源代码
%% Mackey Glass Time Series Prediction Using Least Mean Square (LMS)
%
clc
clear all
close all%% Loading Time series data
% I generated a series y(t) for t = 0,1, . . . ,3000, using
% mackey glass series equation with the following configurations:
% b = 0.1, a = 0.2, Tau = 20, and the initial conditions y(t - Tau) = 0.
load Dataset\Data.mat teacher_forcing=1; % recurrent ARMA modelling with forced desired input after defined time steps
%% Training and Testing datasets
% For training
Tr=Data(100:2500,1); % Selecting a Interval of series data t = 100~2500Ts=Data(2500:3000,1); % Selecting a Interval of series data t = 2500~3000
Ys(Ts)=Data(Ts,2); % Selecting a chuck of series data y(t)%% LMS ParametersU=zeros(M+1,1); % Initial values of taps
W=zeros(M+1,1); % Initial weight of LMSMSE=[]; % Initial mean squared error (MSE)%% Learning weights of LMS (Training)
tic % start
for t=Tr(1):Tr(end)-time_stepsU(1:end-1)=U(2:end); % Shifting of tap windowif (teacher_forcing==1)if rem(t,time_steps)==0 || (t==Tr(1))U(end)=Yr(t); % Input (past/current samples)elseU(end)=Yp(t-1); % Input (past/current samples) endelseendYp(t)=W'*U; % Predicted outpute(t)=Yr(t+time_steps)-Yp(t); % Error in predicted outputW=W+eta*e(t)*U; % Weight update rule of LMSend
training_time=toc; % total time including training and calculation of MSE%% Prediction of a next outcome of series using previous samples (Testing)
tic % start
U=U*0; % Reinitialization of taps (optional)
for t=Ts(1):Ts(end)-time_steps+1if (teacher_forcing==1)if rem(t,time_steps)==0 || (t==Ts(1))U(end)=Ys(t); % Input (past/current samples)elseU(end)=Yp(t-1); % Input (past/current samples) endelseU(end)=Ys(t); % Input (past/current samples)endYp(t)=W'*U; % Calculating output (future value)e(t)=Ys(t+time_steps-1)-Yp(t); % Error in predicted outputE(t)=e(t).^2; % Current mean squared error (MSE)
end
testing_time=toc; % total time including testing and calculation of MSE%% Results
figure(1)
plot(Tr,10*log10(E(Tr))); % MSE curve
hold on
plot(Ts(1:end-time_steps+1),10*log10(E(Ts(1:end-time_steps+1))),'r'); % MSE curve
grid minortitle('Cost Function');
xlabel('Iterations (samples)');
ylabel('Mean Squared Error (MSE)');
legend('Training Phase','Test Phase');figure(2)hold on
plot(Tr(2*M:end),Yp(Tr(2*M:end))','r') % Predicted values during training
plot(Ts,Ys(Ts),'--b'); % Actual unseen data
plot(Ts(1:end-time_steps+1),Yp(Ts(1:end-time_steps+1))','--r'); % Predicted values of mackey glass series (testing)
xlabel('Time: t');
ylabel('Output: Y(t)');
title('Mackey Glass Time Series Prediction Using Least Mean Square (LMS)')
ylim([min(Ys)-0.5, max(Ys)+0.5])
legend('Training Phase (desired)','Training Phase (predicted)','Test Phase (desired)','Test Phase (predicted)');mitr=10*log10(mean(E(Tr))); % Minimum MSE of training
mits=10*log10(mean(E(Ts(1:end-time_steps+1)))); % Minimum MSE of testingdisplay(sprintf('Total training time is %.5f, \nTotal testing time is %.5f \nMSE value during training %.3f (dB),\nMSE value during testing %.3f (dB)', ...
training_time,testing_time,mitr,mits));
三、运行结果
四、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1] 包子阳,余继周,杨杉.智能优化算法及其MATLAB实例(第2版)[M].电子工业出版社,2016.
[2]张岩,吴水根.MATLAB优化算法源代码[M].清华大学出版社,2017.
[3]周品.MATLAB 神经网络设计与应用[M].清华大学出版社,2013.
[4]陈明.MATLAB神经网络原理与实例精解[M].清华大学出版社,2013.
[5]方清城.MATLAB R2016a神经网络设计与应用28个案例分析[M].清华大学出版社,2018.
【时间序列预测】基于matlab LMS麦基玻璃时间序列预测【含Matlab源码 1443期】相关推荐
- 【Matlab电力负荷预测】粒子群优化支持向量机短期电力负荷预测【含GUI源码 751期】
一.代码运行视频(哔哩哔哩) [Matlab电力负荷预测]粒子群优化支持向量机短期电力负荷预测[含GUI源码 751期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 ...
- 【Matlab生物电信号】生物电信号仿真【含GUI源码 684期】
一.代码运行视频(哔哩哔哩) [Matlab生物电信号]生物电信号仿真[含GUI源码 684期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1]董兵,超于毅,李 ...
- 【Matlab语音分析】语音信号分析【含GUI源码 1718期】
一.代码运行视频(哔哩哔哩) [Matlab语音分析]语音信号分析[含GUI源码 1718期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1]韩纪庆,张磊,郑铁 ...
- 【Matlab验证码识别】遗传算法和最大熵优化+大津法(OTSU)+自定义阈值数字验证码识别【含GUI源码 1694期】
一.代码运行视频(哔哩哔哩) [Matlab验证码识别]遗传算法和最大熵优化+大津法(OTSU)+自定义阈值数字验证码识别[含GUI源码 1694期] 二.matlab版本及参考文献 1 matlab ...
- 【Matlab人脸识别】BP神经网络人脸识别(含识别率)【含GUI源码 891期】
一.代码运行视频(哔哩哔哩) [Matlab人脸识别]BP神经网络人脸识别(含识别率)[含GUI源码 891期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1] ...
- 【Matlab人脸识别】形态学教室人数统计(带面板)【含GUI源码 1703期】
一.代码运行视频(哔哩哔哩) [Matlab人脸识别]形态学教室人数统计(带面板)[含GUI源码 1703期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1]孟 ...
- 【Matlab人脸识别】人脸实时检测与跟踪【含GUI源码 673期】
一.代码运行视频(哔哩哔哩) [Matlab人脸识别]人脸实时检测与跟踪[含GUI源码 673期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1]孟逸凡,柳益君 ...
- 【Matlab图像融合】小波变换遥感图像融合【含GUI源码 744期】
一.代码运行视频(哔哩哔哩) [Matlab图像融合]小波变换遥感图像融合[含GUI源码 744期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1] 包子阳,余 ...
- 【Matlab语音加密】语音信号加密解密(带面板)【含GUI源码 181期】
一.代码运行视频(哔哩哔哩) [Matlab语音加密]语音信号加密解密(带面板)[含GUI源码 181期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1]韩纪庆 ...
- 【Matlab身份证识别】身份证号码识别【含GUI源码 014期】
一.代码运行视频(哔哩哔哩) [Matlab身份证识别]身份证号码识别[含GUI源码 014期] 二.matlab版本及参考文献 1 matlab版本 2014a 2 参考文献 [1] 蔡利梅.MAT ...
最新文章
- baidumap api MySQL_百度地图API开发笔记一(基础篇)
- ef AddDays报错
- JavaSE各阶段练习题----集合-Collection-Set-List
- uc3842开关电源电路图_详解6款简单的开关电源电路设计原理图
- HashMap源码详解与对比
- php limit offset 1,laravel自定义分页的实现案例offset()和limit()
- Day005 20210218-20210221
- python读取dat文件写入表格_python DDT读取excel测试数据
- 2021年最新Java学习路线图指南
- 详解三道一维的动态规划算法题
- 【语音识别】基于动态时间规整(DTW)的孤立字语音识别Matlab源码
- 真无线蓝牙耳机哪款音质最好?真无线蓝牙耳机音质排行榜
- 画了一个田径场,可以踢世界杯吗?
- ICCV 2021 | 视觉Transformer中的相对位置编码
- 都23年了你还记得渐进式框架是什么意思吗
- (附源码)springboot校园疫情管理系统 毕业设计021506
- Android自定义控件开发入门与实战(1)绘图基础
- 同步降压电路PCB布局注意事项
- 《统计学习方法》极简笔记P2:感知机数学推导
- 华为招聘Java程序员笔试试卷(一)