matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx

上传人:b****2 文档编号:1408740 上传时间:2023-04-30 格式:DOCX 页数:10 大小:247.33KB
下载 相关 举报
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第1页
第1页 / 共10页
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第2页
第2页 / 共10页
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第3页
第3页 / 共10页
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第4页
第4页 / 共10页
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第5页
第5页 / 共10页
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第6页
第6页 / 共10页
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第7页
第7页 / 共10页
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第8页
第8页 / 共10页
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第9页
第9页 / 共10页
matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx_第10页
第10页 / 共10页
亲,该文档总共10页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx

《matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx(10页珍藏版)》请在冰点文库上搜索。

matlab曲柄滑块机构的运动学仿真Word文档下载推荐.docx

已知连杆长度:

,连杆的转速:

,设曲柄r2以匀速旋转,

初始条件:

仿真以

为输入,计算

,仿真时间0.5s。

2、运动分析

建立封闭矢量方程:

r2+r3=r1 

(9)

将(9)式分解到x与y轴坐标上,得到:

r2cosθ2+r3cosθ3=r1

r2sinθ2+r3sinθ3=0 

(10) 

可得:

r1=r2cosθ2+r3cosθ3

θ3=-arcsin(r2/r3) 

(11) 

对(10)式对时间求导得:

-r2ω2sinθ2+r3ω3sinθ3=v1

r2ω2cosθ2+r3ω3cosθ3=0(12) 

将上式用矩阵形式表示,令:

A=[r3sinθ31

-r3cosθ30]

X=[ω3

v1]

B=[-r2ω2sinθ2

r2ω2cosθ2]

则(12)可表示为:

AX=B。

(13)

从而可解出ω3与v1。

三、MATLAB程序编写

源代码如下:

functionvarargout=z1(varargin)

%Z1MATLABcodeforz1.fig

%Z1,byitself,createsanewZ1orraisestheexisting

%singleton*.

%

%H=Z1returnsthehandletoanewZ1orthehandleto

%theexistingsingleton*.

%Z1('

CALLBACK'

hObject,eventData,handles,...)callsthelocal

%functionnamedCALLBACKinZ1.Mwiththegiveninputarguments.

Property'

'

Value'

...)createsanewZ1orraisesthe

%existingsingleton*.Startingfromtheleft,propertyvaluepairsare

%appliedtotheGUIbeforez1_OpeningFcngetscalled.An

%unrecognizedpropertynameorinvalidvaluemakespropertyapplication

%stop.Allinputsarepassedtoz1_OpeningFcnviavarargin.

%*SeeGUIOptionsonGUIDE'

sToolsmenu.Choose"

GUIallowsonlyone

%instancetorun(singleton)"

.

%Seealso:

GUIDE,GUIDATA,GUIHANDLES

%Edittheabovetexttomodifytheresponsetohelpz1

%LastModifiedbyGUIDEv2.529-Dec-201622:

57:

13

%Begininitializationcode-DONOTEDIT

gui_Singleton=1;

gui_State=struct('

gui_Name'

mfilename,...

'

gui_Singleton'

gui_Singleton,...

gui_OpeningFcn'

z1_OpeningFcn,...

gui_OutputFcn'

z1_OutputFcn,...

gui_LayoutFcn'

[],...

gui_Callback'

[]);

ifnargin&

&

ischar(varargin{1})

gui_State.gui_Callback=str2func(varargin{1});

end

ifnargout

[varargout{1:

nargout}]=gui_mainfcn(gui_State,varargin{:

});

else

gui_mainfcn(gui_State,varargin{:

%Endinitializationcode-DONOTEDIT

%---Executesjustbeforez1ismadevisible.

functionz1_OpeningFcn(hObject,eventdata,handles,varargin)

%Thisfunctionhasnooutputargs,seeOutputFcn.

%hObjecthandletofigure

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%varargincommandlineargumentstoz1(seeVARARGIN)

%Choosedefaultcommandlineoutputforz1

handles.output=hObject;

%Updatehandlesstructure

guidata(hObject,handles);

axes(handles.axes3)

map1=imread('

1.bmp'

);

imshow(map1)

%UIWAITmakesz1waitforuserresponse(seeUIRESUME)

%uiwait(handles.figure1);

%---Outputsfromthisfunctionarereturnedtothecommandline.

functionvarargout=z1_OutputFcn(hObject,eventdata,handles)

%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);

%Getdefaultcommandlineoutputfromhandlesstructure

varargout{1}=handles.output;

%---ExecutesonbuttonpressinpushbuttonRun.

functionpushbuttonRun_Callback(hObject,eventdata,handles)

%主要计算程序

r2=0.1;

%单位m

r3=0.4;

omiga2=str2double(get(handles.edit1,'

String'

));

;

%单位rad/s

x11=1:

500%单位ms

fori=1:

500

theta2(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);

end

axes(handles.axes1)%制表1

plot(x11/1000,omiga3);

xlabel('

时间(t/s)'

ylabel('

连杆角速度ω3(rad/s)'

axes(handles.axes2)%制表2

plot(x11/1000,v3);

滑块速度v1(m/s)'

%hObjecthandletopushbuttonRun(seeGCBO)

functionedit1_Callback(hObject,eventdata,handles)

%hObjecthandletoedit1(seeGCBO)

%Hints:

get(hObject,'

)returnscontentsofedit1astext

%str2double(get(hObject,'

))returnscontentsofedit1asadouble

%---Executesduringobjectcreation,aftersettingallproperties.

functionedit1_CreateFcn(hObject,eventdata,handles)

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:

editcontrolsusuallyhaveawhitebackgroundonWindows.

%SeeISPCandCOMPUTER.

ifispc&

isequal(get(hObject,'

BackgroundColor'

),get(0,'

defaultUicontrolBackgroundColor'

))

set(hObject,'

white'

%---ExecutesonbuttonpressinpushbuttonExit.

functionpushbuttonExit_Callback(hObject,eventdata,handles)

ss=questdlg('

确认退出?

'

退出信息窗口!

继续仿真!

退出仿真!

switchss

case'

delete(handles.figure1);

%hObjecthandletopushbuttonExit(seeGCBO)

四、使用指南和实例仿真

进入MATLAB软件,打开并运行程序。

初始界面:

对ω2的值进行修改,修改为实例中的50*2*pi=314.16,点击开始仿真按钮,得到仿真结果:

点击退出仿真按钮,进入退出界面:

点击继续仿真按钮,则回到程序界面;

点击退出仿真按钮,则退出程序。

五、结语

由四,通过MATLAB仿真得到的结果与实际情况符合。

通过该次作业,我了解并初步掌握了MATLAB的语言编写和guide界面的使用,巩固并加深了对课上知识的理解,受益良多。

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 小学教育 > 语文

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2