写了几行代码,想用来控制所有的子图片,但是发现,只能控制其中一个,除了在
每个子图片代码下面复制粘贴,还有没有其他的方法?代码如下:
% 1. 输入已知数据
clear;
l1=101.6; l2=254; l3=177.8; l4=304.8;
omega1=250;
alpha1=0;
hd=pi/180; du=180/pi;
% 2. 调用子函数 crank_rocker 计算铰链四杆机构位移,角速度,角加速度
for n1=1:361
theta1=(n1-1)*hd;
[theta,omega,alpha]=crank_rocker(theta1,omega1,alpha1,l1,l2,l3,l4);
theta2(n1)=theta(1);theta3(n1)=theta(2);
omega2(n1)=omega(1);omega3(n1)=omega(2);
alpha2(n1)=alpha(1);alpha3(n1)=alpha(2);
end
n1=1:361;
subplot(2,2,1); % 绘位移线图
plot(n1,theta2*du,n1,theta3*du,'k');
title('角位移线图');
xlabel('曲柄转角 \theta_1 / \circ')
ylabel('角位移 / \circ')
grid on; hold on;
text(140,170,'\theta_3')
text(140,30,'\theta_2')
subplot(2,2,2); % 绘角速度线图
plot(n1,omega2,n1,omega3,'k')
title('角速度线图');
xlabel('曲柄转角 \theta_1 / \circ')
ylabel('角速度 / rad\cdots^{-1}')
grid on;hold on;
text(250,130,'\omega_2')
text(130,165,'\omega_3')
subplot(2,2,3); % 绘角加速度线图
plot(n1,alpha2,n1,alpha3,'k')
title('角加速度线图');
xlabel('曲柄转角 \theta_1 / \circ')
ylabel('角加速度 / rad\cdots^{-2}')
grid on;hold on;
text(230,2e4,'\alpha_2')
text(30,7e4,'\alpha_3')
**set(gcf,'Position',[300,150,250,200]);
set(gca,'FontName', '宋体\Times New Roman','FontSize',10);
set(gca,'LooseInset',get(gca,'TightInset'));
grid off;
box off;**
运行以后是这样的,
我想要的效果是,三张图都能像子图3一样,正常显示坐标名称。有没有什么办法?