作业帮 > 综合 > 作业

关于用MATLAB求加速度,

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/10 02:31:48
关于用MATLAB求加速度,
l1=200;
l2=4.28*l1;
l21=4.86*l1;
l3=2.14*l1;
xe=4.24*l1;
ye=1.66*l1;
p=0.7415*pi;
t=0:0.01:2;
xb=200*cos(10*t);
yb=200*sin(10*t);
c=(ye-yb).^2+(xe-xb).^2;
w2=acos((l2^2+c-l3^2)/(2*l2*sqrt(c)))+atan((ye-yb)./(xe-xb));
xc=xb+l2*cos(w2);
yc=yb+l2*sin(w2);
xd=xc-l21*cos(w2+p);
yd=yc-l21*sin(w2+p);
subplot(2,2,1);
plot(xd,yd),grid on 
title('点D的轨迹图像')
xlabel('xd/mm'),ylabel('yd/mm')
subplot(2,2,2);
plot(t,xd),grid on
title('构件5的位移图像')
xlabel('t/s'),ylabel('位移/mm')
v=diff(xd);
subplot(2,2,3);
plot(t(1:end-1),v),grid on
title('构件5的速度图像')
xlabel('t/s'),ylabel('速度/(mm/s)')
a=diff(v);
subplot(2,2,4);
plot(t(1:end-1),a),grid on
title('构件5的加速度图像')
xlabel('t/s'),ylabel('加速度/(mm/s^2)')

问题在于你的t(1:end-1)是200个数,而a是199个数,两个向量长度不一样,应该为plot(t(2:end-1),a),grid on