a. Khai báo các thông số
%File ham chinh hnbtd0.m function zc=hnbtd0(t,y)
%Do cung cua lo xo va do can nhot cua giam chan(N/m), (Ns/m)
kt=2.36*10^6; kb=2.13*10^6; ct=120*10^3;cb=30*10^3;
% Van toc cua toa xe (m/s)
v=(100*1000)/3600;
%Tan so goc kich thich tu mat duong (rad/s)
w=(2*3.14*v)/12.5;
%Khoang cach cua 2 truc va hai coi chuyen(m)
L=7; l=1.1;
%Phuong trinh nhap nho mat duong duoi cac banh xe
y1=0.015*sin(w*t);
y2=0.015*sin(w*t-1.106); y3=0.015*sin(w*t-7.037); y4=0.015*sin(w*t-8.134);
%Van toc cua nhap nho mat duong duoi cac banh xe
y1c=0.015*w*cos(w*t); y2c=0.015*w*cos(w*t-1.106); y3c=0.015*w*cos(w*t-7.037); y4c=0.015*w*cos(w*t-8.134); %Ma tran F F1=kb*(y1+y2)+cb*(y1c+y2c); F2=l*kb*(y1-y2)+cb*(y1c-y2c); F3=0; F4=0; F5=kb*(y3+y4)+cb*(y3c+y4c); F6=l*kb*(y3-y4)+cb*(y3c-y4c);
% Ma tran quan tinh
M=[m 0 0 0 0 0; 0 j 0 0 0 0; 0 0 Ml 0 0 0; 0 0 0 J 0 0; 0 0 0 0 m 0; 0 0 0 0 0 j];
%Ma tran do cung
K=[2*kb+kt 0 -kt -L*kt 0 0; 0 2*l^2*kb 0 0 0 0; -kt 0 2*kt 0 -kt 0; -L*kt 0 0 2*L^2*kt L*kt 0; 0 0 -kt L*kt 2*kb+kt 0; 0 0 0 0 0 2*(l^2)*kb];
%Ma tran can nhot
C=[2*cb+ct 0 -ct -L*ct 0 0; 0 2*(l^2)*cb 0 0 0 0;
-L*ct 0 0 2*L^2*ct L*ct 0; 0 0 -ct L*ct 2*cb+ct 0; 0 0 0 0 0 2*(l^2)*cb]; F=[F1 F2 F3 F4 F5 F6]'; O1=zeros(6); Mn=inv(M); E=eye(6); O2=zeros(6,1); [X,W]=eig(K,M); wn=sqrt(W) % Ma tran [A] A=[O1 E;-Mn*K -Mn*C]; % Vec to f0 f0=Mn*F; % Vec to f f=[O2;f0];
% Phuong trinh trang thai
zc=A*y+f;
b. Giải bài toán và các đồ thị
%File chinh hnbtd.m
%CHUONG TRINH TINH DAO DONG CUA HE NHIEU BAC TU DO global wn %Khai bao bien toan bo
tf=6; %Thoi gian dao dong
z0=[0 .0 0 .0 0 .0 0 .0 0 .0 0 .0]'; %Dieu kien ban dau
[t,z]=ode45('hnbtd0',tf,z0); %Ham ode45 de giai phuong trinh vi phan %t Column vector of time points
%z Solution array. Each row in y corresponds to the solution at a time returned in the %corresponding row of t.
%a=z(:,1); b=poly(a) ?? l?p ?a th?c nghi?m %[t,z]=ode45('hnbttd0',[0:1:tf],z0)
% +sign(y(3))
disp('TAN SO DAO DONG T DO CUA HE') wn=diag(wn) % Tan so dao dong tu do
% Ve do thi chuyen vi cua he
figure(211)
plot(t,z(:,1)*100) % Chuyen vi cua vat -1 (cm)
xlabel(' Thoi gian - s')
ylabel('Chuyen vi cua m1- cm') grid
figure(212);
grid
figure(213)
plot(t,z(:,3)*100) % Chuyen vi cua vat 2 (cm) xlabel(' Thoi gian - s')
ylabel('Chuyen vi cua m2 – cm') grid
figure(214)
plot(t,z(:,4)*100) % Chuyen vi goc quay cua vat 2 (cm)
ylabel('Chuyen vi goc quay cua m2 - rad/s') grid
figure(215)
plot(t,z(:,5)) % Chuyen vi cua vat 3 (cm)
xlabel(' Thoi gian - s')
ylabel('Chuyen vi cua m3 - cm/s') grid
figure(216)
plot(t,z(:,6)*100) % Chuyen vi goc cua vat 3 (cm)
ylabel('Chuyen vi goc quay cua m3-rad/s') grid
figure(217)
plot(t,z(:,7)*100) % Van toc cua vat 1 (cm/s)
xlabel(' Thoi gian - s')
ylabel('Van toc cua m1 - cm/s') grid
figure(218)
plot(t,z(:,8)) % Van toc cua goc vat 1 (rad/s2)
xlabel(' Thoi gian - s')
ylabel('Van toc goc cua m1 - rad/s2') grid
figure(219)
plot(t,z(:,9)*100) % Van toc cua vat 2 (cm)
xlabel(' Thoi gian - s')
ylabel('Van toc cua m2 - cm/s') grid
figure(2110)
plot(t,z(:,10)) % Van toc goc cua vat 2(rad/s2)
xlabel(' Thoi gian - s')
ylabel('Van toc goc cua m2- rad/s2') figure(2111)
plot(t,z(:,11)*100) % Van toc cua vat 3 (cm)
xlabel(' Thoi gian - s')
ylabel('Van toc cua m3 - cm/s') grid
figure(2112)
plot(t,z(:,12)) % Van toc goc cua vat 3 (rad/s2)
ylabel('Van toc goc cua m2- rad/s2') xlabel(' Thoi gian - s')
grid pause
c. Chƣơng trình tính lực động tác dụng vào 2 đầu xe
% chuong trinh tinh luc tac dung len than xe
zt=z(:,3)+L*z(:,4)-z(:,1) % Chuyen vi tuong doi cua coi chuyen voi khung gia truoc
ztc=z(:,9)+L*z(:,10)-z(:,7) % Van toc tuong doi cua coi chuyen voi khung gia truoc
zs= z(:,3)-L*z(:,4)-z(:,5) % Chuyen vi tuong doi cua coi chuyen voi khung gia sau
zsc= z(:,9)-L*z(:,10)-z(:,11) %Van toc tuong doi cua coi chuyen voi khung gia sau %Luc dong tac dung len than xe
Ft=-ct*ztc-kt*zt figure;
subplot(311) plot(t,Ft)
xlabel('Thoi gian-s')
ylabel('Luc tac dung Ft-N') grid
Fs=-ct*zsc-kt*zs; subplot(312) plot(t,Ft)
xlabel('Thoi gian-s')
ylabel('Luc tac dung Ft-N') grid
3. Chƣơng trình tính dao động của hệ khi chạy với vận tốc cộng hƣởng
%File ham toa xe chay voi van toc cong huong toaxech1.m function zc=toaxech1(t,y)
global wn %Khai bao bien toan bo
%Khoi luong va mo men quan tinh cua cac bo phan (kg), (kg.m2)
Ml=40*10^3; m=1.12*10^3; J=[Ml*(2*7+5)^2]/12; j=720;
%Do cung cua lo xo va do can nhot cua giam chan(N/m), (Ns/m)
kt=2.36*10^6; kb=2.13*10^6; ct=120*10^3;cb=30*10^3;
% Van toc cua toa xe (m/s)
v=153.8528; % Van toc cua toa xe lay trong truong hop tan so dao dong rieng bang tan so dao dong kich thich.
%Tan so goc kich thich tu mat duong (rad/s)
w=(2*3.14*v)/12.5;
y1=0.015*sin(w*t);
y2=0.015*sin(w*t-1.106); y3=0.015*sin(w*t-7.037); y4=0.015*sin(w*t-8.134);
%Van toc cua nhap nho mat duong duoi cac banh xe
y1c=0.015*w*cos(w*t); y2c=0.015*w*cos(w*t-1.106); y3c=0.015*w*cos(w*t-7.037); y4c=0.015*w*cos(w*t-8.134);
%Luc kich thich tu mat duong
F1=kb*(y1+y2)+cb*(y1c+y2c); F2=l*kb*(y1-y2)+cb*(y1c-y2c); F3=0; F4=0; F5=kb*(y3+y4)+cb*(y3c+y4c); F6=l*kb*(y3-y4)+cb*(y3c-y4c);
% Ma tran quan tinh
M=[m 0 0 0 0 0; 0 j 0 0 0 0; 0 0 Ml 0 0 0; 0 0 0 J 0 0; 0 0 0 0 m 0; 0 0 0 0 0 j];
%Ma tran do cung
K=[2*kb+kt 0 -kt -L*kt 0 0; 0 2*l^2*kb 0 0 0 0; -kt 0 2*kt 0 -kt 0; -L*kt 0 0 2*L^2*kt L*kt 0; 0 0 -kt L*kt 2*kb+kt 0; 0 0 0 0 0 2*(l^2)*kb];
%Ma tran can nhot
C=[2*cb+ct 0 -ct -L*ct 0 0; 0 2*(l^2)*cb 0 0 0 0; -ct 0 2*ct 0 -ct 0; -L*ct 0 0 2*L^2*ct L*ct 0; 0 0 -ct L*ct 2*cb+ct 0; 0 0 0 0 0 2*(l^2)*cb]; % Ma tran F F=[F1 F2 F3 F4 F5 F6]'; O1=zeros(6); Mn=inv(M); E=eye(6); O2=zeros(6,1);
[X,W]=eig(K,M); % xac dinh tri rieng va vecto rieng wn=sqrt(W) % Ma tran [A] A=[O1 E;-Mn*K -Mn]; % Vec to f0 f0=Mn*F; % Vec to f f=[O2;f0];
% Phuong trinh trang thai
zc=A*y+f
a. Chương trình vẽ đồ thị trong trường hợp xảy ra cộng hưởng
%File chinh toaxech.m
%CHUONG TRINH TINH DAO DONG CUA HE NHIEU BAC TU DO global wn %Khai bao bien toan bo
tf=6; %Thoi gian dao dong
z0=[0 .0 0 .0 0 .0 0 .0 0 .0 0 .0]'; %Dieu kien ban dau
[t,z]=ode45('toaxech1',tf,z0); %Ham ode45 de giai phuong trinh vi phan %Khoi luong va mo men quan tinh cua cac bo phan (kg), (kg.m2)
Ml=40*10^3; m=1.12*10^3; J=[Ml*(2*7+5)^2]/12; j=720;
%Do cung cua lo xo va do can nhot cua giam chan(N/m), (Ns/m)
kt=2.36*10^6; kb=2.13*10^6; cb=120*10^3; ct=30*10^3;
% Van toc cua toa xe (m/s)
v=153.8528;
%Tan so goc kich thich tu mat duong (rad/s)
w=(2*3.14*v)/12.5;
disp('Tan so dao dong cua he - rad/s') wn=diag(wn) % Tan so dao dong tu do % Ve do thi chuyen vi cua he
figure(211)
plot(t,z(:,1)*100) % Chuyen vi cua vat -1 (cm)
xlabel('Thoi gian(s)')
ylabel('Chuyen vi cua m1- cm') grid
figure(212);
plot(t,z(:,2)*100) % Chuyen vi goc quay cua vat 1 (cm)
xlabel('Thoi gian(s)')
ylabel('Chuyen vi goc quay cua m1 - rad/s') grid
figure(213)
plot(t,z(:,3)*100) % Chuyen vi cua vat 2 (cm)
figure(214)
plot(t,z(:,4)*100) % Chuyen vi goc quay cua vat 2 (cm)
xlabel('Thoi gian(s)')
ylabel('Chuyen vi goc quay cua m2 - rad/s') grid
figure(215)
plot(t,z(:,5)) % Chuyen vi cua vat 3 (cm)
xlabel('Thoi gian(s)')
ylabel('Chuyen vi cua m3 - cm/s') grid
figure(216)
plot(t,z(:,6)*100) % Chuyen vi goc cua vat 3 (cm)
xlabel('thoi gian(s)')
ylabel('Chuyen vi goc quay cua m3-rad/s') grid
figure(217)
plot(t,z(:,7)*100) % Van toc cua vat 1 (cm/s)
xlabel('thoi gian(s)')
ylabel('Van toc cua m1 - cm/s') grid
figure(218)
plot(t,z(:,8)) % Van toc cua goc vat 1 (rad/s2)
xlabel('thoi gian(s)')
ylabel('Van toc goc cua m1 - rad/s2') grid
figure(219)
plot(t,z(:,9)*100) % Van toc cua vat 2 (cm)
xlabel('thoi gian(s)')
ylabel('Van toc cua m2 - cm/s') grid
figure(2110)
plot(t,z(:,10)) % Van toc goc cua vat 2(rad/s2)
xlabel('thoi gian(s)')
ylabel('Van toc goc cua m2- rad/s2') figure(2111)
plot(t,z(:,11)*100) % Van toc cua vat 3 (cm)
xlabel('thoi gian(s)')
ylabel('Van toc cua m3 - cm/s') grid
figure(2112)
plot(t,z(:,12)) % Van toc goc cua vat 3 (rad/s2)
ylabel('Van toc goc cua m2- rad/s2') xlabel(' Thoi gian - s')
grid pause
b. Lực động tác dụng lên hai đầu xe trong trường hợp cộng hưởng
% chuong trinh tinh luc tac dung len than xe
zt=z(:,3)+L*z(:,4)-z(:,1) ztc=z(:,9)+L*z(:,10)-z(:,7) zs= z(:,3)-L*z(:,4)-z(:,5) zsc= z(:,9)-L*z(:,10)-z(:,11)
%luc dong tac dung len than xe
Ft=-ct*ztc-kt*zt figure;
subplot(311) plot(t,Ft)
xlabel('Thoi gian-s')
ylabel('Luc tac dung Ft-N') grid
Fs=-ct*zsc-kt*zs; subplot(312) plot(t,Ft)
xlabel('Thoi gian-s')
ylabel('Luc tac dung Ft-N') grid