function varargout = ballist_prob(varargin)
% BALLIST_PROB M-file for ballist_prob.fig
% BALLIST_PROB, by itself, creates a new BALLIST_PROB or raises the existing
% singleton*.
%
% H = BALLIST_PROB returns the handle to a new BALLIST_PROB or the handle to
% the existing singleton*.
%
% BALLIST_PROB('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in BALLIST_PROB.M with the given input arguments.
%
% BALLIST_PROB('Property','Value',...) creates a new BALLIST_PROB or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before ballist_prob_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to ballist_prob_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 ballist_prob
% Last Modified by GUIDE v2.5 09-Jul-2008 15:46:12
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ballist_prob_OpeningFcn, ...
'gui_OutputFcn', @ballist_prob_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if 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 ballist_prob is made visible.
function ballist_prob_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 ballist_prob (see VARARGIN)
% Choose default command line output for ballist_prob
handles.output = hObject;
ax2pos=get(handles.axes2,'position');
ax2x=ax2pos(1);
ax2w=ax2pos(3);
alpos=get(handles.alpha,'position');
% text('position',[(alpos(1)-ax2x)/ax2w alpos(2)+alpos(4)/2],'string','\alpha = ',...
% 'parent',handles.axes2,'VerticalAlignment','middle','HorizontalAlignment','right',...
% 'units','normalized','FontUnits','normalized','FontSize',0.0286,'interpreter','tex');
htal=text('position',[(alpos(1)-ax2x)/ax2w alpos(2)+alpos(4)/2],'string','$\alpha =\;$',...
'parent',handles.axes2,'VerticalAlignment','middle','HorizontalAlignment','right',...
'units','normalized','interpreter','latex','FontSize',10);
%get(htal,'FontSize')
%get(handles.figure1,'position')
vpos=get(handles.v,'position');
htv=text('position',[(vpos(1)-ax2x)/ax2w vpos(2)+vpos(4)/2],'string','$|\overrightarrow{V_0}| =\;$',...
'parent',handles.axes2,'VerticalAlignment','middle','HorizontalAlignment','right',...
'units','normalized','interpreter','latex','FontSize',10);
afpos=get(handles.af,'position');
htfl=text('position',[0.5 afpos(2)-alpos(4)],'string','$\overrightarrow{F_{fr}}=-p(\overrightarrow{V})$',...
'parent',handles.axes2,'VerticalAlignment','middle','HorizontalAlignment','center',...
'units','normalized','interpreter','latex','FontSize',10);
vwpos=get(handles.vw,'position');
htvw=text('position',[(vwpos(1)-ax2x)/ax2w vwpos(2)+vwpos(4)/2],'string','$V_w =\;$',...
'parent',handles.axes2,'VerticalAlignment','middle','HorizontalAlignment','right',...
'units','normalized','interpreter','latex','FontSize',10);
fud={{htal,htv,htfl,htvw}};
set(handles.figure1,'UserData',fud);
set(htfl,'visible','off');
set(handles.text3,'visible','off');
set(handles.p,'visible','off');
set(handles.text4,'visible','off');
set(handles.text13,'visible','off');
set(handles.m,'visible','off');
set(handles.text14,'visible','off');
set(handles.aw,'visible','off');
set(htvw,'visible','off');
set(handles.vw,'visible','off');
set(handles.text5,'visible','off');
set(handles.text7,'visible','off');
set(handles.axes1,'NextPlot','add');
hbd=plot(0,0,'ob','parent',handles.axes1,'MarkerSize',7); %body
xlabel(handles.axes1,'x, m');
ylabel(handles.axes1,'y, m');
als=get(handles.alpha,'string');
if get(handles.rad,'value')
al=str2num(als);
else
al=pi*str2num(als)/180;
end
V=str2num(get(handles.v,'string'));
g=str2num(get(handles.g,'string'));
S=V^2*sin(2*al)/g;
H=V^2*(sin(al))^2/(2*g);
m=max([abs(H) abs(S)]);
if cos(al)>=0
gr=plot([-m*0.2 m*1.2],[0 0],'-k','parent',handles.axes1);
set(handles.axes1,'Xlim',[-m*0.1 m*1.1],'Ylim',[-m*0.1 m*1.1]);
else
gr=plot([-m*1.2 m*0.2],[0 0],'-k','parent',handles.axes1);
set(handles.axes1,'Xlim',[-m*1.1 m*0.1],'Ylim',[-m*0.1 m*1.1]);
end
pth=plot(0,0,'r-','parent',handles.axes1);
set(pth,'visible','off');
set(handles.axes1,'UserData',{hbd,gr,pth});
% set axes equal
set(handles.axes1,'DataAspectRatio',[1 1 1],'DataAspectRatioMode','manual',...
'PlotBoxAspectRatio',[3 4 4],'PlotBoxAspectRatioMode','manual');
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes ballist_prob wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = ballist_prob_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;
function alpha_Callback(hObject, eventdata, handles)
% hObject handle to alpha (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 alpha as text
% str2double(get(hObject,'String')) returns contents of alpha as a double
% --- Executes during object creation, after setting all properties.
function alpha_CreateFcn(hObject, eventdata, handles)
% hObject handle to alpha (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
function V_Callback(hObject, eventdata, handles)
% hObject handle to V (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 V as text
% str2double(get(hObject,'String')) returns contents of V as a double
% --- Executes during object creation, after setting all properties.
function V_CreateFcn(hObject, eventdata, handles)
% hObject handle to V (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 af.
function af_Callback(hObj


海神之光
- 粉丝: 5w+
- 资源: 7136
最新资源
- FPGA纯Verilog编解码CameraLink视频的设计与实现:从HDMI解码到CameraLink模拟循环验证,FPGA纯Verilog编解码CameraLink视频循环验证方案介绍,FPGA纯
- GDB调试神器指南:5步定位C程序中的幽灵bug.pdf
- Linux系统编程入门:用C实现多进程通信的聊天室项目.pdf
- Linux环境编程实战:Vim+GCC调试技巧大公开.pdf
- Linux环境下的C语言开发:GCC、Vim调试全流程详解.pdf
- Makefile编写入门:3步让你的C项目告别重复编译.pdf
- Rust程序员眼中的C语言:安全编程的兼容性与改造策略.pdf
- Linux系统编程入门:用C语言实现文件批量处理器.pdf
- switch-case深度解析:为什么你的break总在捣乱?.pdf
- STM32开发入门:用C语言点亮你的第一个LED.pdf
- switch-case的隐藏BUG:break缺失引发的系统崩溃实录.pdf
- Valgrind内存检测实战:让程序不再薛定谔的崩溃.pdf
- Switch-case使用误区大揭秘:break缺失引发的血泪教训.pdf
- Valgrind内存检测:揪出C程序中的隐藏炸弹.pdf
- VSCode+C编译器配置指南:打造高效开发环境.pdf
- VSCode+C插件配置指南:智能提示、自动补全、一键调试.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


