一、获取代码方式

获取代码方式1:
完整代码已上传我的资源:【游戏】基于 matlab GUI lanchester作战模拟设计【含Matlab源码 426期】

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

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

二、部分源代码

function varargout = lcst(varargin)
% LCST M-file for lcst.fig
%      LCST, by itself, creates a new LCST or raises the existing
%      singleton*.
%
%      H = LCST returns the handle to a new LCST or the handle to
%      the existing singleton*.
%
%      LCST('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in LCST.M with the given input arguments.
%
%      LCST('Property','Value',...) creates a new LCST or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before lcst_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to lcst_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 lcst% Last Modified by GUIDE v2.5 26-Oct-2008 20:07:52% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...'gui_Singleton',  gui_Singleton, ...'gui_OpeningFcn', @lcst_OpeningFcn, ...'gui_OutputFcn',  @lcst_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 lcst is made visible.
function lcst_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 lcst (see VARARGIN)
axes(handles.axes2);
[x1,map]=imread('1.jpg');
[x2,map]=imread('2.jpg');
x3=imread('3.jpg');x4=imread('4.jpg');
x5=imread('5.jpg');
x6=imread('6.jpg');
x7=imread('7.jpg');
x8=imread('8.jpg');x9=imread('9.jpg');x10=imread('10.jpg');x11=imread('11.jpg');
M(1)=im2frame(x1,map);
M(2)=im2frame(x2,map);M(3)=im2frame(x3,map);
M(4)=im2frame(x4,map);M(5)=im2frame(x5,map);
M(6)=im2frame(x6,map);M(7)=im2frame(x7,map);
M(8)=im2frame(x8,map);M(9)=im2frame(x9,map);
M(10)=im2frame(x10,map);
M(11)=im2frame(x11,map);
movie(M,1000,3)
% Choose default command line output for lcst
handles.output = hObject;% Update handles structure
guidata(hObject, handles);% This sets up the initial plot - only do when we are invisible
% so window can get raised using lcst.% UIWAIT makes lcst wait for user response (see UIRESUME)
% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.
function varargout = lcst_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 simulation.
function simulation_Callback(hObject, eventdata, handles)
% hObject    handle to simulation (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
axes(handles.axes1);
cla;
x0=str2double(get(handles.red1,'String'));a=str2double(get(handles.red2,'String'));y0=str2double(get(handles.blue1,'String'));b=str2double(get(handles.blue2,'String'));%  for k=1:100
%      t(k)=et/100*k
%         x(k)=x0-a*t(k);
%         y(k)=y0-b*t(k);
%  end
popup_sel_index = get(handles.popupmenu1, 'Value');%根据不同的定律进行计算switch popup_sel_indexcase 1if a*y0>b*x0et=x0/a;Rb=(a*y0-b*x0)/a;Rr=0;w='蓝方';
end
if a*y0<b*x0et=y0/b;Rr=(b*x0-a*y0)/b;Rb=0;w='红方';
end
if a*y0==b*x0et=x0/a;Rr=0;Rb=0;w='同归于尽';
endset(handles.winp,'string',w);set(handles.endt,'string',num2str(et));set(handles.redr,'string',num2str(Rr));set(handles.bluer,'string',num2str(Rb));
%         if x(end)==0plot([0,et],[x0,Rr],'r-');hold onplot([0,et],[y0,Rb],'b-');hold offgrid ongrid minorcase 2if a*y0^2>b*x0^2w='蓝方';Rb=sqrt(y0^2-(b/a)*x0^2)Rr=0;et=log((sqrt(b)*x0+sqrt(a)*y0)/(-sqrt(b)*x0+sqrt(a)*y0))/2/sqrt(a*b);endif a*y0^2<b*x0^2w='红方';Rr=sqrt(x0^2-(a/b)*y0^2)Rb=0;et=log((sqrt(b)*x0+sqrt(a)*y0)/(sqrt(b)*x0-sqrt(a)*y0))/2/sqrt(a*b);endset(handles.winp,'string',w);%显示计算结果set(handles.endt,'string',num2str(et));set(handles.redr,'string',num2str(Rr));set(handles.bluer,'string',num2str(Rb));%fh = @(x,y) a.*x.^2 - b.*y.^2 - a.*y0.^2+b.*x0.^2;%ezplot(@(x,y)myfun(x,y,x0,a,y0,b),[0,x0]);t=[0:0.1:et];ab=sqrt(a*b);x=x0*cosh(ab*t)-(sqrt(a/b)*y0)*sinh(ab*t);y=y0*cosh(ab*t)-(sqrt(b/a)*x0)*sinh(ab*t);plot(t,x,'r-');hold on plot(t,y,'b-');hold offgrid minor
%         bar(1:.5:10);
%     case 4
%         plot(membrane);
%     case 5
%         surf(peaks);
end% --------------------------------------------------------------------
function FileMenu_Callback(hObject, eventdata, handles)
% hObject    handle to FileMenu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function OpenMenuItem_Callback(hObject, eventdata, handles)
% hObject    handle to OpenMenuItem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
file = uigetfile('*.fig');
if ~isequal(file, 0)open(file);
end% --------------------------------------------------------------------
function PrintMenuItem_Callback(hObject, eventdata, handles)
% hObject    handle to PrintMenuItem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
printdlg(handles.figure1)% --------------------------------------------------------------------
function CloseMenuItem_Callback(hObject, eventdata, handles)
% hObject    handle to CloseMenuItem (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
selection = questdlg(['Close ' get(handles.figure1,'Name') '?'],...['Close ' get(handles.figure1,'Name') '...'],...'Yes','No','Yes');
if strcmp(selection,'No')return;
enddelete(handles.figure1)% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
if (double(get(hObject,'Value')==2))set(handles.text6,'ForegroundColor','yellow');
end% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called% Hint: popupmenu controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))set(hObject,'BackgroundColor','blue');
endset(hObject, 'String', {'lanchester线性律', 'lanchester平方律', });%选择菜单的设计function red1_Callback(hObject, eventdata, handles)
% hObject    handle to red1 (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 red1 as text
%        str2double(get(hObject,'String')) returns contents of red1 as a double% --- Executes during object creation, after setting all properties.
function red1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to red1 (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

三、运行结果

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 包子阳,余继周,杨杉.智能优化算法及其MATLAB实例(第2版)[M].电子工业出版社,2016.
[2]张岩,吴水根.MATLAB优化算法源代码[M].清华大学出版社,2017.

【游戏】基于 matlab GUI lanchester作战模拟设计【含Matlab源码 426期】相关推荐

  1. 【运动学】基于matlab GUI三体运动模拟【含Matlab源码 871期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[运动学]基于matlab GUI三体运动模拟[含Matlab源码 871期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2: ...

  2. 【音乐播放】基于matlab GUI动感音乐播放【含Matlab源码 778期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[音乐播放]基于matlab GUI动感音乐播放[含Matlab源码 778期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2: ...

  3. 【雷达通信】基于matlab GUI相控阵雷达方向图【含Matlab源码 1048期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[雷达通信]基于matlab GUI相控阵雷达方向图[含Matlab源码 1048期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方 ...

  4. 【数据分析】基于matlab GUI齿轮箱振动数据分析【含Matlab源码 2122期】

    一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[数据分析]基于matlab GUI齿轮箱振动数据分析[含Matlab源码 2122期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方 ...

  5. 【光学】基于matlab GUI维达尔之眼计算【含Matlab源码 2545期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[光学]基于matlab GUI维达尔之眼计算[含Matlab源码 2545期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2: ...

  6. 【光学】基于matlab GUI双孔干涉【含Matlab源码 2119期】

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

  7. 【光学】基于matlab GUI双缝干涉和牛顿环【含Matlab源码 2165期】

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

  8. 【数字信号】基于matlab GUI电话按键识别【含Matlab源码 2382期】

    ⛄一.获取代码方式 获取代码方式1: 完整代码已上传我的资源:[数字信号]基于matlab GUI电话按键识别[含Matlab源码 2382期] 点击上面蓝色字体,直接付费下载,即可. 获取代码方式2 ...

  9. Matlab GUI/APP 浅谈(附计算器源码)

    Matlab GUI/APP 浅谈(附计算器源码) 今天没有什么段子,也没有心灵鸡汤.毒鸡汤啥的,纯粹聊一聊这些年从有关MATLAB GUI/APP开发中悟出的一点道理,顺便把计算器的源代码给大家. ...

  10. 基于Java毕业设计爱心公益网站设计与制作源码+系统+mysql+lw文档+部署软件

    基于Java毕业设计爱心公益网站设计与制作源码+系统+mysql+lw文档+部署软件 基于Java毕业设计爱心公益网站设计与制作源码+系统+mysql+lw文档+部署软件 本源码技术栈: 项目架构:B ...

最新文章

  1. 分类问题中的“维数灾难” - robotMax
  2. 学习笔记:CentOS 7学习之十一:文件的重定向
  3. LaTeX技巧如何拆分源文件并且分别编译
  4. 解答: 刷DFT 版 Windows Phone 依然无法越狱安装程序的原因
  5. 文献学习(part16)--Oracle Based Active Set Algorithm for Scalable Elastic Net Subspace Clustering
  6. 云计算的关键特点及挑战
  7. 实验二 固件设计(小组)
  8. (一)洞悉linux下的Netfilteriptables:什么是Netfilter?
  9. win10系统文件拖拽卡顿_IT技巧分享16:如何让win10摆脱卡顿
  10. DC-DC电路设计要点 及 计算 全解析
  11. 硕士论文latex参考文献格式经验
  12. TL431-精密基准电压源
  13. 微信公众号二次开发(1)
  14. IDEA配置关联Git
  15. mysql 计算农历_MySQL 获取农历年函数
  16. C语言大数相乘(整形)
  17. 标准工时产能如何计算?工厂现场管理必学
  18. 无多普勒频移的海底混响单元散射模型卷积法
  19. 期末课程设计—学生成绩查询系统
  20. 客户回访|国产MCU测试解决方案 助力中国“芯”智造

热门文章

  1. SAP安装前应准备的事项
  2. python读图片生成ROI并保存
  3. 190715每日一句
  4. Atitit TPL(事务处理语言 目录 1.1. 事务隔离级别 1 1.2. Savepoint技术 1 2. Tpl 1 2.1.  打开事务 START TRANSACTION; 1 2.2.
  5. Atitit cs计算机科学概论 艾提拉解读版 2. 第二部分 信息层 4 5. 第三部分 硬件层 5 8. 第四部分 程序设计层 7 13. 第五部分 操作系统层 10 16. 第六部分 应
  6. Atitit 综合原则 软件与项目开发中的理念信念 目录 1.1. 建议组合使用扬长避短 1 1.2. 常见数据库 mysql oracle mssql mongodb postgre sqlit
  7. Atiit 常见功能 常用功能与模块的最快速解决方案
  8. Atitit 图像处理类库 halcon11  安装与环境搭建attilax总结
  9. paip.c++ 转换 java 解决方案
  10. paip.svn不能提交CLEARUP不起作用解决方法