气动学外弹道仿真系统:基于Matlab GUI的设计

案例简介

1 设计要求及条件

【气动学】基于matlab GUI外弹道仿真系统【含Matlab源码 1044期】_matlab



设计分析

【气动学】基于matlab GUI外弹道仿真系统【含Matlab源码 1044期】_2d_02


部分源代码

登录后复制

function varargout = simulation_GUI(varargin)% SIMULATION_GUI M-file for simulation_GUI.fig%      SIMULATION_GUI, by itself, creates a new SIMULATION_GUI or raises the existing%      singleton*.%%      H = SIMULATION_GUI returns the handle to a new SIMULATION_GUI or the handle to%      the existing singleton*.%%      SIMULATION_GUI('CALLBACK',hObject,eventData,handles,...) calls the local%      function named CALLBACK in SIMULATION_GUI.M with the given input arguments.%%      SIMULATION_GUI('Property','Value',...) creates a new SIMULATION_GUI or raises the%      existing singleton*.  Starting from the left, property value pairs are%      applied to the GUI before simulation_GUI_OpeningFcn gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to simulation_GUI_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 simulation_GUI% Last Modified by GUIDE v2.5 09-Jun-2021 11:01:14% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @simulation_GUI_OpeningFcn, ...                   'gui_OutputFcn',  @simulation_GUI_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{:});else    gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before simulation_GUI is made visible.function simulation_GUI_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 simulation_GUI (see VARARGIN)% Choose default command line output for simulation_GUIhandles.output = hObject;set(handles.hon,'String','标准大气压hon=760mmHg');set(handles.taoon,'String','标准虚温τon=288.4℃');set(handles.R,'String','标准气体常数R=29.27');set(handles.G,'String','温度梯度G=5.6828e-3');set(handles.eon,'String','标准水蒸气分压eon=8.4mmHg');set(handles.q,'String','弹重q=216.5kg');set(handles.d,'String','弹径d=0.299m');set(handles.L,'String','弹长L=2.11m');set(handles.gon,'String','重力加速度g=760mmHg');set(handles.Cxo,'String','空气阻力系数Cxo=0.16');set(handles.S,'String','标准下落时间S=21.12秒');% Update handles structureguidata(hObject, handles);% UIWAIT makes simulation_GUI wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = simulation_GUI_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 structurevarargout{1} = handles.output;% --- Executes on button press in draw_2d.function draw_2d_Callback(hObject, eventdata, handles)% hObject    handle to draw_2d (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)set(handles.z_inform,'Visible','off');set(handles.xend,'String',0);guidata(hObject, handles);set(handles.yend,'String',2000);guidata(hObject, handles);set(handles.zend,'String',0);guidata(hObject, handles);u0 = str2num(get(handles.u0,'String'));p0 = str2num(get(handles.p0,'String'));x0 = str2num(get(handles.x0,'String'));y0 = str2num(get(handles.y0,'String'));fu=@(y,u,p)(-0.081931*(1-1.9705*10^(-5)*y)^6.0119/(288.4+5.6828*10^(-3)*(2000-y))*u^2);fp=@(u)(9.806/u);fx=@(u)(u);fy=@(u,p)(u*p);h=0.025;N=1000;T=zeros(1,N+1);U=zeros(1,N+1);P=zeros(1,N+1);X=zeros(1,N+1);Y=zeros(1,N+1);U(1)=u0;P(1)=p0;X(1)=x0;Y(1)=y0-y0;for i=1:N    fu1=feval(fu,Y(i),U(i),P(i));    fp1=feval(fp,U(i));    fx1=feval(fx,U(i));    fy1=feval(fy,U(i),P(i));        fu2=feval(fu,Y(i)+h/2*fy1,U(i)+h/2*fu1,P(i)+h/2*fp1);    fp2=feval(fp,U(i)+h/2*fu1);    fx2=feval(fx,U(i)+h/2*fu1);    fy2=feval(fy,U(i)+h/2*fu1,P(i)+h/2*fp1);        fu3=feval(fu,Y(i)+h/2*fy2,U(i)+h/2*fu2,P(i)+h/2*fp2);    fp3=feval(fp,U(i)+h/2*fu2);    fx3=feval(fx,U(i)+h/2*fu2);    fy3=feval(fy,U(i)+h/2*fu2,P(i)+h/2*fp2);        fu4=feval(fu,Y(i)+h*fy3,U(i)+h*fu3,P(i)+h*fp3);    fp4=feval(fp,U(i)+h*fu3);    fx4=feval(fx,U(i)+h*fu3);    fy4=feval(fy,U(i)+h*fu3,P(i)+h*fp3);        U(i+1)=U(i)+h*(fu1+2*fu2+2*fu3+fu4)/6;    P(i+1)=P(i)+h*(fp1+2*fp2+2*fp3+fp4)/6;    X(i+1)=X(i)+h*(fx1+2*fx2+2*fx3+fx4)/6;    Y(i+1)=Y(i)+h*(fy1+2*fy2+2*fy3+fy4)/6;    set(handles.xend,'String',num2str(X(i)));    guidata(hObject, handles);        endl=find(Y>y0);l=l(1);U=U(1:l);P=P(1:l);X=X(1:l);Y=Y(1:l);U;P;X;Y=y0-Y;imge_2d=plot(X,Y,'r');labelx_2d=xlabel('X:Firing Range');labely_2d=ylabel('Y:Firing Altitude');handles.img_2d = imge_2d;%保存句柄handles.img_2d = labelx_2d;handles.img_2d = labely_2d;str=get(handles.code_2d,'String');eval(str);guidata(hObject,handles); xl = num2str(X(l));set(handles.xend,'String',xl);guidata(hObject, handles);set(handles.yend,'String',0.000);guidata(hObject, handles);% --- Executes on button press in draw_3d.function draw_3d_Callback(hObject, eventdata, handles)% hObject    handle to draw_3d (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)set(handles.xend,'String',0);guidata(hObject, handles);set(handles.yend,'String',2000);guidata(hObject, handles);set(handles.zend,'String',0);guidata(hObject, handles);u0 = str2num(get(handles.u0,'String'));p0 = str2num(get(handles.p0,'String'));x0 = str2num(get(handles.x0,'String'));y0 = str2num(get(handles.y0,'String'));z0 = str2num(get(handles.z0,'String'));fu=@(y,u,p)(-0.081931*(1-1.9705*10^(-5)*y)^6.0119/(288.4+5.6828*10^(-3)*(2000-y))*u^2);fp=@(u)(9.806/u);fx=@(u)(u);fy=@(u,p)(u*p);fz=@()(z0);1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.67.68.69.70.71.72.73.74.75.76.77.78.79.80.81.82.83.84.85.86.87.88.89.90.91.92.93.94.95.96.97.98.99.100.101.102.103.104.105.106.107.108.109.110.111.112.113.114.115.116.117.118.119.120.121.122.123.124.125.126.127.128.129.130.131.132.133.134.135.136.137.138.139.140.141.142.143.144.145.146.147.148.149.150.151.152.153.154.155.156.157.158.159.160.161.162.163.164.165.166.167.168.169.170.171.172.173.174.175.176.177.178.179.180.181.182.183.184.185.186.187.188.189.190.191.192.193.194.195.196.197.198.199.200.201.202.203.204.205.


运行结果

【气动学】基于matlab GUI外弹道仿真系统【含Matlab源码 1044期】_2d_03

【气动学】基于matlab GUI外弹道仿真系统【含Matlab源码 1044期】_3d_04


matlab版本

1 matlab版本

2014a


免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删

QR Code
微信扫一扫,欢迎咨询~

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 155-2731-8020
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

手机不正确

公司不为空