matlab程序运行不了,clear clc tic n=1000;h=linspace(0,0.5,n); ii=3; b=0.15; R=0.111; %驱动轮A与转向轮横向偏距a1a1=0.08; %驱动轮B与转向轮横向偏距a2a2=0.08;
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 23:49:46
matlab程序运行不了,clear clc tic n=1000;h=linspace(0,0.5,n); ii=3; b=0.15; R=0.111; %驱动轮A与转向轮横向偏距a1a1=0.08; %驱动轮B与转向轮横向偏距a2a2=0.08;
matlab程序运行不了,
clear
clc
tic
n=1000;
h=linspace(0,0.5,n);
ii=3;
b=0.15;
R=0.111;
%驱动轮A与转向轮横向偏距a1
a1=0.08;
%驱动轮B与转向轮横向偏距a2
a2=0.08;
%曲柄半径r1
r1=0.01347;
%绳轮半径r2
r2=0.006;
%驱动轴与转向轮的距离d
d=0.18;
%转向杆的长c
c=0.06;
l=sqrt(b^2+r1^2)+(0.351)/1000;
%算法
g=-10;
sd2=h/r2;
sd1=sd2/ii+pi/2;
C=l^2-2*c^2-r1^2.*(cos(sd1)).^2-(b-r1.*sin(sd1)).^2;
A=2.*c.*(b-r1.*sin(sd1));
B=-2*c^2;
af=asin(C./sqrt(A.^2+B.^2))-atan(B./A);
format long
rou=a1+(d)./(tan(af));
s=sd2*R;
ds=s(2)-s(1);
dbd=ds./(rou);
bd=cumsum(dbd);
dy=ds*cos(bd);
dx=-ds*sin(bd);
x=cumsum(dx);
y=cumsum(dy);
xb=x-(a1+a2).*cos(bd);
yb=y-(a1+a2).*sin(bd);
xc=x-a1*cos(bd)-d*sin(bd);
yc=y-a1*sin(bd)+d*cos(bd);
plot(x,y,'b',xb,yb,'b',xc,yc,'m');
hold on
grid on
for i=1:9
t=0:0.01:2*pi;
xy=0.01.*cos(t)-0.23;
yy=0.01.*sin(t)+i;
plot(xy,yy);
hold on
end
toc
matlab程序运行不了,clear clc tic n=1000;h=linspace(0,0.5,n); ii=3; b=0.15; R=0.111; %驱动轮A与转向轮横向偏距a1a1=0.08; %驱动轮B与转向轮横向偏距a2a2=0.08;
可以运行啊
如下图所示
Elapsed time is 0.057728 seconds.