问题描述
我需要编写代码来帮助在MATLAB中模拟6 bar机制。我已包含图像和数据。假设可以旋转360度。
我正在使用的数据在第4行。
这是我尝试使用的某些代码结构,但是某些功能出现错误,例如“联合驱动程序功能”
如果有人可以帮助我,我将不胜感激。
% R-RRR-TR Mechanism
% complete rotation of the driver
clear all; clc; close all
OA = 0.040;
AB = 0.100 ; % m
BC = 0.070 ; % m
OC = 0.120; % m
CE = 0.060 ; % m
DE = 0.065 ; % m
n = 1200; % rpm
% I need to represent 320 degrees
omega=pi*n/30.; % rad/s
alpha = 0.; % rad/s^2
xA = 0; yA = 0;
xD = 0; yD = -AD;
rD_ = [xD yD 0];
% initial moment phi=pi/4 => increment = 0
increment = 0 ;
% the step has to be small for this method
step=pi/18;
for phi=pi/4:step:2*pi+pi/4
% position of joint B
jointB = xA;yA;AB;phi;omega;alpha;
xB = jointB(1);
yB = jointB(2);
% position of joint C
posC = p3Pn(xD,yD,xB,yB,CD);
xC = posC(1);
yC = posC(2);
% position of joint E
phi5 = pi;
posE = pRRT(xC,yC,yE,CE,phi5);
xE1 = posE(1);
xE2 = posE(3);
if increment == 0
if xE1 < xC xE = xE1;
else xE = xE2; end
else
dist1 = dist(xE1,xEold,yE);
dist2 = dist(xE2,yE);
if dist1<dist2 xE=xE1;
else xE=xE2; end
end
xEold=xE;
increment=increment+1;
phi4 = atan((yE-yC)/(xE-xC));
% centroid of link 4
xC4(increment)=(xC+xE)/2;
yC4(increment)=(yC+yE)/2;
% graphic of the mechanism
axis manual
axis equal
hold on
grid on
axis([-0.65 0.65 -0.4 0.4])
xlabel('x (m)'),ylabel('y (m)')
pM=plot(...
[xA,xB],[yA,yB],'r-o',...
[xD,xC],[yD,yC],'b-o',...
[xC,xE],[yC,yE],'k-o');
plot(xC4,yC4,'k.','Color','red')
pause(1)
delete(pM)
end
text(xA,yA,' A')
text(xB,' B')
text(xC,' C')
text(xD,' D')
text(xE,' E')
plot(...
[xA,'k-o')
title('Path described by C_4')
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)