1、matlab曲柄滑块机构的运动学仿真系统仿真与matlab综合试题题目:曲柄滑块机构的运动学仿真编号: 21 难度系数: 姓名 班级 学号 联系方式 成绩 错误!未定义书签错误!未定义书签 错误!未定义书签 错误!未定义书签 错误!未定义书签 错误!未定义书签 错误!未定义书签一、引言 二、运动学分析 1、 实例题目 2、 运动分析 三、 MATLA程序编写 四、 使用指南和实例仿真 五、 结语 、引言曲柄滑块机构是指用曲柄和滑块来实现转动和移动相互转换的平 面连杆机构,也称曲柄连杆机构。曲柄滑块机构广泛应用于往复活塞 式发动机、压缩机、冲床等的主机构中,把往复移动转换为不整周或 整周的回转运
2、动;压缩机、冲床以曲柄为主动件,把整周转动转换为 往复移动。这里使用运动学知识,对其运动进行解析,并用MATL AE为其设计仿真模块。二、运动学分析1、实例题目对图示单缸四冲程发动机中常见的曲柄滑块机构进行运动学仿 真。已知连杆长度:D 0.1m , r3 0.4m,连杆的转速:2 2 , 3 3 ,设曲柄r2以匀速旋转,2 50r/s。初始条件:2 3 0。仿真以2为输入,计算3和A,仿真时间。曲柄滑块机构示意图P2、运动分析建立封闭矢量方程:将(9)式分解到x与y轴坐标上,得到:r2 cos 0 2+r3cos 0 3=r1r2sin 0 2+r3sin 0 3=0(10)可得:r1 =r
3、2cos 0 2+r3cos 0 30 3=-arcsin(r2/r3)(11)对(10)式对时间求导得: -r2 3 2sin 0 2+ r3 w 3sin 0 3=v1r2 w 2cos 0 2+ r3 w 3cos 0 3=0 (12)将上式用矩阵形式表示,令:-r3cos 0 30A= r3sin 0 3 1X= s3v1B=-r2 3 2sin 0 2r2 3 2cos 0 2则 (12) 可表示为:AX=B。 (13)从而可解出 33与 v1。三、MATLA程序编写源代码如下:function varargout = z1(varargin)% Z1 MATLAB code for
4、% Z1, by itself, creates a new Z1 or raises the existing% singleton*.% H = Z1 returns the handle to a new Z1 or the handle to% the existing singleton*.% Z1(CALLBACK,hObject,eventData,handles,.) callsthe local% function named CALLBACKin with the given input arguments.% Z1(Property,Value,.) creates a
5、new Z1 or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before z1_OpeningFcn gets called.An% unrecognized property name or invalid value makes property application% stop. All inputs are passed to z1_OpeningFcn via varargin.% *See GUI Options on
6、 GUIDEs 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 z1% Last Modified by GUIDE 29-Dec-2016 22:57:13% Begin initialization code - DO NOT EDIT gui_Singleton = 1;gui_State = struct(gui_Nam
7、e, mfilename, .gui_Singleton, gui_Singleton, .gui_OpeningFcn, z1_OpeningFcn, .gui_OutputFcn, z1_OutputFcn, .gui_LayoutFcn, , .gui_Callback, ); if nargin & ischar(varargin1) = str2func(varargin1);end if nargoutvarargout1:nargout = gui_mainfcn(gui_State, varargin:);elsegui_mainfcn(gui_State, varargin:
8、);end% End initialization code - DO NOT EDIT% - Executes just before z1 is made visible.function z1_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 ofMATLAB%handles s
9、tructure with handles and user data (see GUIDATA)% varargin command line arguments to z1 (see VARARGIN)% Choose default command line output for z1= hObject;% Update handles structureguidata(hObject, handles);axesmap1=imread();imshow(map1)% UIWAIT makes z1 wait for user response (see UIRESUME)% uiwai
10、t;% - Outputs from this function are returned to the command line.function varargout = z1_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 ofMATLAB%handles structu
11、re with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout1 = ;% - Executes on button press in pushbuttonRun.function pushbuttonRun_Callback(hObject, eventdata, handles) %主要计算程序r2=;%单位mr3=;%单位momiga2=str2double(get,String); % 单位 rad/sx11=1:500 % 单位 m
12、sfor i=1:500theta2(i)=i*omiga2/1000;theta3(i)=asin(-r2/r3*sin(theta2(i);B=-r2*omiga2*sin(theta2(i);r2*omiga2*cos(theta2(i);A=r3*sin(theta3(i) 1;-r3*cos(theta3(i) 0;X=inv(A)*B;omiga3(i)=X(1,1);v3(i)=X(2,1);endaxes % 制表 1 plot(x11/1000,omiga3);xlabel( 时间( t/s ) )ylabel(连杆角速度3 3 (rad/s )axes % 制表 2plot
13、(x11/1000,v3);xlabel( 时间( t/s )ylabel( 滑块速度 v1( m/s)% hObject handle to pushbuttonRun (see GCBO)% eventdata reserved - to be defined in a future version ofMATLAB%handles structure with handles and user data (see GUIDATA)function edit1_Callback(hObject, eventdata, handles) % hObject handle to edit1 (
14、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 edit1 as text% str2double(get(hObject,String) returns contentsof edit1 as a double% - Executes during object creatio
15、n, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to edit1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after allCreateFcns called% Hint: edit controls usually have a white
16、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 pushbuttonExit.function pushbuttonExit_Callback(hObject, eventdata, handles)ss=questdlg( 确认退出 , 退出信
17、息窗口! , 继续仿真! , 退出仿 真!, 退出仿真! );switch sscase 退出仿真! delete;end% hObject han die to pushbutto nExit (see GCBO)% eve ntdata reserved - to be defi ned in a future vers ion ofMATLAB%handles structure with handles and user data (see GUIDATA)四、使用指南和实例仿真 进入MATLAB件,打开并运行程序初始界面:对3 2的值进行修改,修改为实例中的 50*2*pi=,点击开始仿真按钮,得到仿真结果:J也鎚曲柄滑块机构的运动学仿貞HI券 #改 i=drVdlr2_-Q iim5=0.4 muj2= 314.16 ra)d5 计上朮肖rFT-fnO55t昨者:UI42CirQJ D3时|fi) Vt)02 03时IH (ft)= 1O 老 JQ点击退出仿真按钮,进入退出界面:点击继续仿真按钮,则回到程序界面;点击退出仿真按钮,则退出程 序。五、结语由四,通过MATLA仿真得到的结果与实际情况符合。 通过该次作 业,我了解并初步掌握了 MATLAB勺语言编写和guide界面的使用, 巩固并加深了对课上知识的理解,受益良多。
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1