一、获取代码方式

获取代码方式1:
完整代码已上传我的资源:【数学建模】基于matlab GUI干线交通控制方法【含Matlab源码 1259期】

获取代码方式2:
通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。

备注:
订阅紫极神光博客付费专栏,可免费获得2份代码(有效期为订阅日起,三天内有效);

三、部分源代码

function varargout = CrossSim(varargin)
% CROSSSIM MATLAB code for CrossSim.fig
%      CROSSSIM, by itself, creates a new CROSSSIM or raises the existing
%      singleton*.
%
%      H = CROSSSIM returns the handle to a new CROSSSIM or the handle to
%      the existing singleton*.
%
%      CROSSSIM('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in CROSSSIM.M with the given input arguments.
%
%      CROSSSIM('Property','Value',...) creates a new CROSSSIM or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before CrossSim_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to CrossSim_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help CrossSim% Last Modified by GUIDE v2.5 06-Dec-2020 16:56:12% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...'gui_Singleton',  gui_Singleton, ...'gui_OpeningFcn', @CrossSim_OpeningFcn, ...'gui_OutputFcn',  @CrossSim_OutputFcn, ...'gui_LayoutFcn',  [] , ...'gui_Callback',   []);
if nargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});
endif nargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
elsegui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT% --- Executes just before CrossSim is made visible.
function CrossSim_OpeningFcn(hObject, eventdata, handles, varargin)
% 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 (see GUIDATA)
% varargin   command line arguments to CrossSim (see VARARGIN)% Choose default command line output for CrossSim
handles.output = hObject;% Update handles structure
guidata(hObject, handles);
data = get(handles.main_fig,'UserData');
data.stop = false;
data.running = 0;
set(handles.main_fig,'UserData',data);% UIWAIT makes CrossSim wait for user response (see UIRESUME)
% uiwait(handles.main_fig);% --- Outputs from this function are returned to the command line.
function varargout = CrossSim_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Get default command line output from handles structure
varargout{1} = handles.output;% --- Executes on button press in sim_button.
function sim_button_Callback(hObject, eventdata, handles)
% hObject    handle to sim_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)data = get(handles.main_fig,'UserData');
set(handles.sim_button, 'String', 'Pause simulation');switch data.runningcase 0if (get(handles.type_1d,'Value') == 1)type = 1;city_gen;city = 'city.mat';elsetype = 2;city_gen_2d;city = 'city_2d.mat';endload(city);cyc = str2double(get(handles.cycles,'String'));p = str2double(get(handles.speed,'String'));newFig = figure;set(newFig,'Name','CrossSim Simulator');b = Builder(city);s = Simulation(b);d = Drawer(b);if (get(handles.custom_mode,'Value') == 1)mode = 1;elseif (get(handles.opt_mode,'Value') == 1)mode = 2;elsemode = 3;endc = 1;switch (type)case 1switch (mode)case 1load('custom.mat');gts = gts_1d;case 2disp('Optimalization has started');gts = gaoptim(b, cyc);disp('Optimalization has finished');case 3gts = zeros(1,(cyc-1)*b.numbers(1)) + 20;rts = 0;off = 0;endcase 2switch (mode)case 1load('custom.mat');gts = gts_2d;rts = rts_2d;off = off_2d;case 2disp('Optimalization has started');[gts, rts, off] = time_calc(b);disp('Optimalization has finished');case 3gts = zeros(1,b.numbers(1)) + 20;rts = zeros(1,b.numbers(1)) + 10;for i = 1:b.numbers(1)off(i) = mod(i,3)*10;endendends.init(gts,rts,off,rn(c:c+b.numbers(2)),type);isPaused = 0;data.stop = false;data.running = 1;set(handles.main_fig, 'UserData', data);keep_running = 1;while (keep_running == 1 && max(b.cycles) < cyc)while (isPaused == 1)data = get(handles.main_fig,'UserData');if data.running == 1isPaused=0;enddata = get(handles.main_fig,'UserData');if data.stopkeep_running=0;isPaused=0;endpause(0.5);endfigure(newFig);switch (type)case 1s.simulate_1(gts,1,rn(c:c+b.numbers(2)));case 2s.simulate_2(gts,rts,off,1,rn(c:c+b.numbers(2)));endd.draw();pause(p);M(c) = getframe(gcf);c = c + 1;data = get(handles.main_fig,'UserData');if data.stopkeep_running=0;enddata = get(handles.main_fig,'UserData');if data.running == 2isPaused=1;endendclose(newFig);if (get(handles.save_cb, 'Value') == 1)movie2avi(M, get(handles.filename, 'String'), 'fps', 5);endset(handles.sim_button, 'String', 'Start simulation');data.stop = true;data.running = 0;set(handles.main_fig, 'UserData', data);case 1data.running = 2;set(handles.main_fig, 'UserData', data);set(handles.sim_button, 'String', 'Continue simulation');case 2data.running = 1;set(handles.main_fig, 'UserData', data);set(handles.sim_button, 'String', 'Pause simulation');
endfunction cycles_Callback(hObject, eventdata, handles)
% hObject    handle to cycles (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of cycles as text
%        str2double(get(hObject,'String')) returns contents of cycles as a double% --- Executes during object creation, after setting all properties.
function cycles_CreateFcn(hObject, eventdata, handles)
% hObject    handle to cycles (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
endfunction speed_Callback(hObject, eventdata, handles)
% hObject    handle to speed (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of speed as text
%        str2double(get(hObject,'String')) returns contents of speed as a double% --- Executes during object creation, after setting all properties.
function speed_CreateFcn(hObject, eventdata, handles)
% hObject    handle to speed (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','white');
end% --- Executes on button press in exit_button.
function exit_button_Callback(hObject, eventdata, handles)
% hObject    handle to exit_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)close(handles.main_fig);% --- Executes on button press in custom_mode.
function custom_mode_Callback(hObject, eventdata, handles)
% hObject    handle to custom_mode (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of custom_mode% --- Executes on button press in opt_mode.
function opt_mode_Callback(hObject, eventdata, handles)
% hObject    handle to opt_mode (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of opt_mode% --- Executes on button press in save_cb.
function save_cb_Callback(hObject, eventdata, handles)
% hObject    handle to save_cb (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of save_cb% --- Executes on button press in save_button.
function save_button_Callback(hObject, eventdata, handles)
% hObject    handle to save_button (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)if (get(handles.type_1d,'Value') == 1)type = 1;city_gen;city = 'city.mat';
elsetype = 2;city_gen_2d;city = 'city_2d.mat';
enddelete(get(handles.filename, 'String'));
mymovie = avifile(get(handles.filename, 'String'), 'compression','None', 'fps', 5);load(city);cyc = str2double(get(handles.cycles,'String'));
p = str2double(get(handles.speed,'String'));
newFig = figure('Visible', 'off');
set(newFig,'Name','CrossSim Simulator');
%set(newFig, 'Visible', 'off');
b = Builder(city);
s = Simulation(b);
d = Drawer(b);

四、运行结果


五、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1]李昕.MATLAB数学建模[M].清华大学出版社.2017
[2]王健,赵国生.MATLAB数学建模与仿真[M].清华大学出版社.2016
[3]余胜威.MATLAB数学建模经典案例实战[M].清华大学出版社.2015

【数学建模】基于matlab GUI干线交通控制方法【含Matlab源码 1259期】相关推荐

  1. 【光学】基于matlab GUI杨氏双缝干涉【含Matlab源码 001期】

    一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[光学]基于matlab GUI杨氏双缝干涉[含Matlab源码 001期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2: 付费 ...

  2. 基于JAVA智能道路交通管理系统计算机毕业设计源码+系统+mysql数据库+lw文档+部署

    基于JAVA智能道路交通管理系统计算机毕业设计源码+系统+mysql数据库+lw文档+部署 基于JAVA智能道路交通管理系统计算机毕业设计源码+系统+mysql数据库+lw文档+部署 本源码技术栈: ...

  3. 【人脸识别】基于matlab GUI人数统计【含Matlab源码 2121期】

    ⛄一.人数统计简介(附课程作业报告) 1 课题背景 本课题为基于matlab的人数统计系统.近年来,很多行业对人流信息有极大的需求,如汽车公交站,地铁站台,商场出入口等.通过人数统计系统可以方便.可靠 ...

  4. 基于SSM的仓库管理系统(含完整源码+论文)

    后端框架:SSM 数据库:MySQL 开发工具:IDEA/Eclipse 系统介绍:本系统是基于SSM框架进行设计,MySQL作为底层数据库,前端采用bootstrap 模块大致介绍:包括库存管理.出 ...

  5. 【条形码识别】基于matlab GUI二维条形码识别【含Matlab源码 607期】

    ⛄一.二维条形码识别简介 采用数字图像处理技术对二维条码进行识别, 是二维条形码识别中较常用的方法, 它在处理污损的条形码方面有光电识别方法无法比拟的优势.另外图像式识别方法对识别角度的要求没有光电识 ...

  6. 【心电信号】基于matlab GUI心电信号预处理【含Matlab源码 938期】

    ⛄一.心电信号预处理方法简介 理论知识参考文献:心电信号预处理方法研究 ⛄二.部分源代码 function varargout = kaishi(varargin) gui_Singleton = 1 ...

  7. matlab svm 语音识别,【情感识别】基于matlab支持向量机(SVM)的语音情感识别【含Matlab源码 543期】...

    一.简介 支持向量机(Support Vector Machine)是Cortes和Vapnik于1995年首先提出的,它在解决小样本.非线性及高维模式识别中表现出许多特有的优势,并能够推广应用到函数 ...

  8. 【数学建模】基于matlab武汉地铁2号线路线地图动态模拟【含Matlab源码 1092期】

    一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[数学建模]基于matlab武汉地铁2号线路线地图动态模拟[含Matlab源码 1092期] 点击上面蓝色字体,直接付费下载,即可. 获取代 ...

  9. 【数学建模】基于matlab船舶三自由度MMG模型【含Matlab源码 1925期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[数学建模]基于matlab船舶三自由度MMG模型[含Matlab源码 1925期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式 ...

  10. 【数学建模】基于matlab动态水波仿真【含Matlab源码 2056期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[数学建模]基于matlab动态水波仿真[含Matlab源码 2056期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2: 付费 ...

最新文章

  1. LeetCode简单题之删除一个元素使数组严格递增
  2. 【基于libRTMP的流媒体直播之 AAC、H264 推送】
  3. 分布式文件系统MooseFS初探
  4. python numpy hstack() from shape_base.py (将数组水平堆叠)
  5. 人工智能---机器学习
  6. 机器学习实战-回归算法-18
  7. js检测弹出窗口拦截程序
  8. java实现鼠标截图,java实现屏幕截图(附源码)
  9. 欧氏空间内积定义_泛函分析笔记3:内积空间
  10. Android:自定义滚动边缘(EdgeEffect)效果
  11. 10 个步骤让你成为高效的 Web 开发者
  12. vista下推荐大家用foobar2000播放器
  13. R语言预测shibor走势:prophet
  14. 计算机组成原理白中英第四章,计算机组成原理 白中英第四章 指令系统.ppt
  15. QT音乐播放器(接入网易云API)
  16. 从底层看android5.0系统的启动过程
  17. 软件包下载地址(一)
  18. 产品化与项目之间的关系
  19. 【泛函分析】存在有可列个间断点的单调函数
  20. 经典C语言算法题之快乐数

热门文章

  1. xshell使用隧道
  2. VIm中Python自动补全插件Pydiction
  3. unity 切换场景
  4. ubuntu一些记录
  5. cgi、fast-cgi、php-pfm关系
  6. 查找本库包括某字段的全部表
  7. (转)PMP的项目管理5大组
  8. 学习 TList 类的实现[1]
  9. 20200614每日一句
  10. 20191130每日一句