龙空技术网

基于MATLAB的一次移动平均法预测App

云龙派 45

前言:

现在大家对“matlab安装出现install message”可能比较关切,我们都需要知道一些“matlab安装出现install message”的相关知识。那么小编同时在网上汇集了一些有关“matlab安装出现install message””的相关内容,希望各位老铁们能喜欢,朋友们快快来了解一下吧!

移动平均法是运用过去时间序列的数据进行统计分析去推测事物的发展趋势,适用于历史序列的基本趋势变化不大且序列中随机变动成分较多时使用,只适合做近期预测。之前介绍了基于MATLAB的guide制作的一次移动平均法计算的GUI界面,但是随着MATLAB版本的更新,之后的版本不再支持guide制作的GUI界面,因此我基于MATLAB App Designer将一次移动平均法模型修改成App,这样可以兼容2016之后的版本,也不受最新版本的限制。

基于MATLAB的一次移动平均法预测App如下:

加载数据——输入原始数据起始年份、原始数据最终年份、步长数、预测数据个数、x轴坐标名称、y轴坐标名称——点击开始计算即可出现结果,同时会在当前文件夹下生成预测数据的excel文件“MSE.xlsx”,“结果.xlsx”和预测结果图的bmp、fig、jpg和pdf格式文件。需要基于MATLAB的一次移动平均法预测App完整程序,可以进行打赏后截图(30元及以上),在微信公众号云龙派里电竞迷“联系掌门”菜单进行联系,或者在公众号内回复截图,几小时内会回复。App Designer编程不易,还请见谅!

1.基于MATLAB的一次移动平均法预测App举例计算

数据为内蒙古2009-2017年货品运输数量,利用一次移动平均法向后预测3年。

Step1:点击yiciyidongApp.mlappinstall文件,在MATLAB中双击安装APP,点击安装到我的APP。

Step2:在APP 菜单栏中找到我的app中的yiciyidongApp,双击运行出App主界面。

Step3:点击加载数据,选择数据excel文件,并点击确定。

Step4:输入参数。

Step5:点击开始计算。

Step6:运行结果文件生成。

2.App主要程序如下

classdef yiciyidongapp < matlab.apps.AppBase    % Properties that correspond to app components    properties (Access = public)        UIFigure          matlab.ui.Figure        Panel             matlab.ui.container.Panel        Panel_2           matlab.ui.container.Panel        Button            matlab.ui.control.Button        Label_3           matlab.ui.control.Label        EditField         matlab.ui.control.NumericEditField        Label_4           matlab.ui.control.Label        EditField_2       matlab.ui.control.NumericEditField        Label_5           matlab.ui.control.Label        EditField_3       matlab.ui.control.NumericEditField        xEditFieldLabel   matlab.ui.control.Label        xEditField        matlab.ui.control.EditField        yEditFieldLabel   matlab.ui.control.Label        yEditField        matlab.ui.control.EditField        EditField_4Label  matlab.ui.control.Label        EditField_4       matlab.ui.control.EditField        Panel_3           matlab.ui.container.Panel        Button_2          matlab.ui.control.Button        Button_3          matlab.ui.control.Button        Button_4          matlab.ui.control.Button        Panel_4           matlab.ui.container.Panel        UIAxes            matlab.ui.control.UIAxes        TextArea          matlab.ui.control.TextArea        UITable           matlab.ui.control.Table        Label             matlab.ui.control.Label        UITable_2         matlab.ui.control.Table        Label_2           matlab.ui.control.Label    end    % Callbacks that handle component events    methods (Access = private)        % Button pushed function: Button_3        function Button_3Pushed(app, event)            app.EditField.Value = 0;            app.EditField_2.Value = 0;            app.EditField_3.Value = 0;            app.EditField_4.Value = " ";                        app.xEditField.Value = " ";            app.yEditField.Value = " ";            app.UITable.Data = [];%矩阵数据使表格为空            app.UITable_2.Data = [];                        try                delete(allchild(app.UIAxes));            end        end        % Button pushed function: Button_4        function Button_4Pushed(app, event)            closereq;        end        % Button pushed function: Button        function ButtonPushed(app, event)                        %加载数据  使用全局变量传递加载的数据            global data12            [filename,pathname,filterindex]=uigetfile({'*.xlsx';'*.txt';'*.*'},'打开数据');            if ~filename                return;            end            str1=[pathname,filename];            if (filename==0 & pathname==0)                msgbox('您没有选择文件,请重新选择!','打开文件出错','error');            else                %                 data=xlsread (strcat([pathname filename])); %strcat是组成路径的。                data12 = xlsread (strcat([pathname filename]));                msgbox('打开及读取数据完毕!','确认','warn');            end        end

本文内容来源于网络,仅供参考学习,如内容、图片有任何版权问题,请联系处理,24小时内删除。

作 者 | 郭志龙

编 辑 | 郭志龙

校 对 | 郭志龙

标签: #matlab安装出现install message #matlab gui滑动条步长