
% 清空工作空间和命令窗口
 clear;
 clc;
% 模拟生成时间t,位移y(t)和角位移theta(t)
 t = linspace(0, 100, 1000);  % 时间从0到100,包含1000个点
 y = 1e-5 * sin(2 * pi * 0.1 * t) .* exp(-0.01 * t);  % 位移y(t) 振荡衰减
 theta = 1e-6 * cos(2 * pi * 0.1 * t) .* exp(-0.01 * t); % 角位移theta(t) 振荡衰减
% 绘制时程图(线性位移与角位移随时间)
 figure;
 subplot(2,1,1);
 plot(t, y, 'k', 'LineWidth', 1.5);
 xlabel('time (s)');
 ylabel('y (m)');
 title('a) 线性位移随时间');
 grid on;
subplot(2,1,2);
 plot(t, theta, 'k', 'LineWidth', 1.5);
 xlabel('time (s)');
 ylabel('\theta (rad)');
 title('b) 角位移随时间');
 grid on;
% 绘制相位图(位移-角位移的相图)
 figure;
 plot(y, theta, 'k', 'LineWidth', 1.5);
 xlabel('y (m)');
 ylabel('\theta (rad)');
 title('相位图:角位移 \theta 与线性位移 y 的关系');
 grid on;