【動力學】基於matlab GUI汽車動力學分析系統【含Matlab原始碼 1050期】
阿新 • • 發佈:2021-06-22
一、簡介
在縱向時,可能還會受到縱向空氣阻力,前輪滾動阻力,後輪滾動阻力,坡道重力分量等
二、原始碼
function varargout = CVPower(varargin) % CVPOWER Application M-file for CVPower.fig % FIG = CVPOWER launch CVPower GUI. % CVPOWER('callback_name', ...) invoke the named callback. % Last Modified by GUIDE v2.0 14-Sep-2020 21:44:17 if nargin == 0 % LAUNCH GUI fig = openfig(mfilename,'reuse'); % Use system color scheme for figure: set(fig,'Color',get(0,'defaultUicontrolBackgroundColor')); % Generate a structure of handles to pass to callbacks, and store it. handles = guihandles(fig); guidata(fig, handles); if nargout > 0 varargout{1} = fig; end elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK try if (nargout) [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard else feval(varargin{:}); % FEVAL switchyard end catch disp(lasterr); end end %| ABOUT CALLBACKS: %| GUIDE automatically appends subfunction prototypes to this file, and %| sets objects' callback properties to call them through the FEVAL %| switchyard above. This comment describes that mechanism. %| %| Each callback subfunction declaration has the following form: %| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN) %| %| The subfunction name is composed using the object's Tag and the %| callback type separated by '_', e.g. 'slider2_Callback', %| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'. %| %| H is the callback object's handle (obtained using GCBO). %| %| EVENTDATA is empty, but reserved for future use. %| %| HANDLES is a structure containing handles of components in GUI using %| tags as fieldnames, e.g. handles.figure1, handles.slider2. This %| structure is created at GUI startup using GUIHANDLES and stored in %| the figure's application data using GUIDATA. A copy of the structure %| is passed to each callback. You can store additional information in %| this structure at GUI startup, and you can change the structure %| during callbacks. Call guidata(h, handles) after changing your %| copy to replace the stored original so that subsequent callbacks see %| the updates. Type "help guihandles" and "help guidata" for more %| information. %| %| VARARGIN contains any extra arguments you have passed to the %| callback. Specify the extra arguments by editing the callback %| property in the inspector. By default, GUIDE sets the property to: %| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo)) %| Add any extra arguments after the last argument, before the final %| closing parenthesis. % -------------------------------------------------------------------- function varargout = pushbutton1_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = pushbutton2_Callback(h, eventdata, handles, varargin) close CVPower; h2=waitbar(0,'edit interface is openning,please wait...'); for i2=1:1000 waitbar(i2/1000); end close(h2); CVPowerEdit; % -------------------------------------------------------------------- function varargout = pushbutton3_Callback(h, eventdata, handles, varargin) close CVPower; % -------------------------------------------------------------------- function varargout = CVPowerEdit(varargin) % CVPOWEREDIT Application M-file for CVPowerEdit.fig % FIG = CVPOWEREDIT launch CVPowerEdit GUI. % CVPOWEREDIT('callback_name', ...) invoke the named callback. % Last Modified by GUIDE v2.0 16-Sep-2020 23:57:39 if nargin == 0 % LAUNCH GUI fig = openfig(mfilename,'reuse'); % Generate a structure of handles to pass to callbacks, and store it. handles = guihandles(fig); guidata(fig, handles); if nargout > 0 varargout{1} = fig; end elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK try if (nargout) [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard else feval(varargin{:}); % FEVAL switchyard end catch disp(lasterr); end end %| ABOUT CALLBACKS: %| GUIDE automatically appends subfunction prototypes to this file, and %| sets objects' callback properties to call them through the FEVAL %| switchyard above. This comment describes that mechanism. %| %| Each callback subfunction declaration has the following form: %| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN) %| %| The subfunction name is composed using the object's Tag and the %| callback type separated by '_', e.g. 'slider2_Callback', %| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'. %| %| H is the callback object's handle (obtained using GCBO). %| %| EVENTDATA is empty, but reserved for future use. %| %| HANDLES is a structure containing handles of components in GUI using %| tags as fieldnames, e.g. handles.figure1, handles.slider2. This %| structure is created at GUI startup using GUIHANDLES and stored in %| the figure's application data using GUIDATA. A copy of the structure %| is passed to each callback. You can store additional information in %| this structure at GUI startup, and you can change the structure %| during callbacks. Call guidata(h, handles) after changing your %| copy to replace the stored original so that subsequent callbacks see %| the updates. Type "help guihandles" and "help guidata" for more %| information. %| %| VARARGIN contains any extra arguments you have passed to the %| callback. Specify the extra arguments by editing the callback %| property in the inspector. By default, GUIDE sets the property to: %| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo)) %| Add any extra arguments after the last argument, before the final %| closing parenthesis. %-------------------------------------------------------------------- % global nmin nmax ne Ttq m1 m2 r nt f CD A If Iwf Iwr i0 ig Uastar Uaend get1 get2 % if get1==1&get2==0 % set(handles.radio1,'value',1); % set(handles.edit1,'string',num2str(nmin)); % set(handles.edit2,'string',num2str(nmax)); % else % if get1==0&get2==1 % set(handles.radio2,'value',1); % set(handles.edit3,'string',num2str(ne)); % set(handles.edit4,'string',num2str(Ttq)); % end % end % set(handles.edit1,'string',num2str(nmin)); % set(handles.edit2,'string',num2str(nmax)); % set(handles.edit3,'string',num2str(ne)); % set(handles.edit4,'string',num2str(Ttq)); % set(handles.edit5,'string',num2str(m1)); % set(handles.edit6,'string',num2str(m2)); % set(handles.edit7,'string',num2str(r)); % set(handles.edit8,'string',num2str(nt)); % set(handles.edit9,'string',num2str(f)); % set(handles.edit10,'string',num2str(CD)); % set(handles.edit11,'string',num2str(A)); % set(handles.edit12,'string',num2str(If)); % set(handles.edit13,'string',num2str(Iwf)); % set(handles.edit14,'string',num2str(Iwr)); % set(handles.edit15,'string',num2str(i0)); % set(handles.edit16,'string',num2str(ig)); % set(handles.edit17,'string',num2str(Uastar)); % set(handles.edit18,'string',num2str(Uaend)); % -------------------------------------------------------------------- function varargout = edit1_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit2_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit3_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit4_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit5_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit6_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit7_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit8_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit9_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit10_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit11_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit12_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit13_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit14_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit15_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit16_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit17_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = edit18_Callback(h, eventdata, handles, varargin) % -------------------------------------------------------------------- function varargout = radiobutton1_Callback(h, eventdata, handles, varargin) set(handles.radio1,'value',get(handles.radio1,'max')); set(handles.radio2,'value',get(handles.radio2,'min')); set(handles.edit1,'enable','on'); set(handles.edit2,'enable','on'); set(handles.edit3,'enable','off'); set(handles.edit4,'enable','off');
三、執行結果
四、備註
版本:2014a
完整程式碼或代寫加1564658423