摘要:讲解TOPSIS法的原理,并通过MATLAB的GUI界面设计计算,操作更简单,不会编程也能用。
注:本文的理论部分的内容主要来自微信公众号“好玩的MATLAB”的《TOPSIS法》一文。
逼近理想解排序法也称优劣解距离法,是多目标决策分析中一种常用的距离综合评价方法。基本思想是定义决策问题的理想解和负理想解,根据有限个评价对象与理想解的接近程度进行排序,找到最优方案。 正负理想解是一个方案集中并不存在的虚拟最佳、最劣方案。它的每个属性值都是决策矩阵中该属性的最好的值、最坏的值。
本人基于MATLAB的GUI界面设计了一个操作简单TOPSIS法计算功能界面如下:
点击导入数据按键——点击计算权重——在三种方法层次分析法、熵权法和变异系数法中选择一个方法计算权重,获得权重计算的权重excel文件——点击导入权重数据按键——点击开始计算——出现结果显示加载的数据表、每个指标对应的权重和每个个体的得分表——同时生成对应的数据结果exce文件:TOPSIS法得分表.xlsx和TOPSIS法指标权重.xlsx。需要基于MATLAB的TOPSIS法的GUI计算界面完整GUI程序,可以进行赞赏后截图点击加载数据,选择数据excel文件
(2)点击确定
(3)点击计算权重
(4)选择一种方法计算指标权重
(例如选择变异系数法求权重,则点击相应的按键)
其他方法计算权重方法界面
(5)点击变异系数法求权重界面中的导入数据按键
(6)点击确定,并输入负向指标的位置(如果有负向指标的话)
(7)点击开始计算
同时会生成权重的excel文件
(8)点击关闭回到主界面
(9)点击关闭回到TOPSIS法计算界面
(10)点击导入权重数据,并点击确定,之后点击开始计算
2.GUI主要程序如下
function varargout = TOPSISjisuanjiemian % TOPSISJISUANJIEMIAN MATLAB code for TOPSISjisuanjiemian.fig % TOPSISJISUANJIEMIAN, by itself, creates a new TOPSISJISUANJIEMIAN or raises the existing % singleton*. % % H = TOPSISJISUANJIEMIAN returns the handle to a new TOPSISJISUANJIEMIAN or the handle to % the existing singleton*. % % TOPSISJISUANJIEMIAN calls the local % function named CALLBACK in TOPSISJISUANJIEMIAN.M with the given input arguments. % % TOPSISJISUANJIEMIAN creates a new TOPSISJISUANJIEMIAN or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before TOPSISjisuanjiemian_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to TOPSISjisuanjiemian_OpeningFcn via varargin. % % *See GUI Options on GUIDE&34;GUI allows only one % instance to run ". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help TOPSISjisuanjiemian % Last Modified by GUIDE v2.5 10-Apr-2022 22:34:25 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct; if nargin && ischar gui_State.gui_Callback = str2func; end if nargout [varargout{1:nargout}] = gui_mainfcn; else gui_mainfcn; end % End initialization code - DO NOT EDIT % --- Executes just before TOPSISjisuanjiemian is made visible. function TOPSISjisuanjiemian_OpeningFcn % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data % varargin command line arguments to TOPSISjisuanjiemian % Choose default command line output for TOPSISjisuanjiemian handles.output = hObject; movegui; %关闭窗口的名字 修改为其他名字 set; % Update handles structure guidata; % UIWAIT makes TOPSISjisuanjiemian wait for user response % uiwait; % --- Outputs from this function are returned to the command line. function varargout = TOPSISjisuanjiemian_OutputFcn % varargout cell array for returning output args ; % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data % Get default command line output from handles structure varargout{1} = handles.output; % --- Executes on button press in pushbutton1. function pushbutton1_Callback % hObject handle to pushbutton1 % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data tableData = []; set; set; set;
3.理论部分
TOPSIS法(逼近理想解排序法)采用相对接近度来表征各个评价对象与参考点的距离。首先在空间确定出参考点,包括最优和最劣点,然后计算各个评价对象与参考点的距离,与最优点越近或与最劣点越远说明被评价对象的综合特性越好。
以上就是朝夕生活(www.30zx.com)关于“基于MATLAB的TOPSIS法GUI计算界面”的详细内容,希望对大家有所帮助!