浅沫记忆 发表于 2021-12-31 20:26:26

【机械仿真】基于matlab GUI 汽车悬架(钢板弹簧+减震器)设计【含Matlab源码 1631期】

一、获取代码方式

二、部分源代码

function varargout = xuanjia(varargin)
% XUANJIA M-file for xuanjia.fig
%      XUANJIA, by itself, creates a new XUANJIA or raises the existing
%      singleton*.
%
%      H = XUANJIA returns the handle to a new XUANJIA or the handle to
%      the existing singleton*.
%
%      XUANJIA('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in XUANJIA.M with the given input arguments.
%
%      XUANJIA('Property','Value',...) creates a new XUANJIA or raises the
%      existing singleton*.Starting from the left, property value pairs are
%      applied to the GUI before xuanjia_OpeningFunction gets called.An
%      unrecognized property name or invalid value makes property application
%      stop.All inputs are passed to xuanjia_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 xuanjia

% Last Modified by GUIDE v2.5 07-Jan-2021 17:37:57

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',gui_Singleton, ...
                   'gui_OpeningFcn', @xuanjia_OpeningFcn, ...
                   'gui_OutputFcn',@xuanjia_OutputFcn, ...
                   'gui_LayoutFcn',[] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before xuanjia is made visible.
function xuanjia_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdatareserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to xuanjia (see VARARGIN)

% Choose default command line output for xuanjia
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes xuanjia wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = xuanjia_OutputFcn(hObject, eventdata, handles)
% varargoutcell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdatareserved - 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 edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdatareserved - 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 edit1 as text
%      str2double(get(hObject,'String')) returns contents of edit1 as a double
input = str2num(get(hObject,'String'))
if (isempty(input))   
    set(hObject,'String','0')
end
guidata(hObject, handles);


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdatareserved - 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 edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdatareserved - 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 edit2 as text
%      str2double(get(hObject,'String')) returns contents of edit2 as a double
input = str2num(get(hObject,'String'))
if (isempty(input))   
    set(hObject,'String','0')
end
guidata(hObject, handles);


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdatareserved - 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 edit3_Callback(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdatareserved - 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 edit3 as text
%      str2double(get(hObject,'String')) returns contents of edit3 as a double

input = str2num(get(hObject,'String'))
if (isempty(input))   
    set(hObject,'String','0')
end
guidata(hObject, handles);

% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit3 (see GCBO)
% eventdatareserved - 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 参考文献
门云阁.MATLAB物理计算与可视化.清华大学出版社,2013.
王增胜,朱煜钰,孔令云.曲柄摇杆机构运动分析与仿真.机械工程与自动化. 2014,(01)






https://blog.51cto.com/u_15324424/4869403
页: [1]
查看完整版本: 【机械仿真】基于matlab GUI 汽车悬架(钢板弹簧+减震器)设计【含Matlab源码 1631期】