0% found this document useful (0 votes)
165 views

%AME 521 Project Task1 Kengyu Lin USCID:9852103390

This document contains MATLAB code for analyzing the dynamics of a multi-degree of freedom system representing a beam structure. The code defines system matrices and solves the equations of motion numerically using the Runge-Kutta method. Plots of displacement over time are generated for different points on the beam, showing its dynamic response both with and without an impulsive load applied.

Uploaded by

api-268501572
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
165 views

%AME 521 Project Task1 Kengyu Lin USCID:9852103390

This document contains MATLAB code for analyzing the dynamics of a multi-degree of freedom system representing a beam structure. The code defines system matrices and solves the equations of motion numerically using the Runge-Kutta method. Plots of displacement over time are generated for different points on the beam, showing its dynamic response both with and without an impulsive load applied.

Uploaded by

api-268501572
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

%AME 521 Project Task1 Kengyu Lin USCID:9852103390

clear;
clc;
%~1a
me=200; %kg
k2=1.3*10^5; %N/m
c2=1.02*10^3; %kg/s
d=1.65; %m
Mb=1650; %kg
Ib=2330; %kg-m^2
k1=2.5*10^5; %N/m
c1=2.73*10^3; %kg/s
m=75; %kg
k=2.5*10^5; %N/m
c=1.48*10^3; %kg/s
L1=1.4; %m
L2=1.3; %m
syms w
Lr=10; %m
vc=Lr*w; %m/s~~~~~~varible
t0=(L1+L2)/vc;
y0=0.08; %m
M=[m 0 0 0 0;
0 m 0 0 0;
0 0 Mb 0 0;
0 0 0 me 0;
0 0 0 0 Ib];
C=[c1+c 0 -c1 0 -c1*L2;
0 c1+c -c1 0 c1*L1;
-c1 -c1 2*c1+c2 -c2 c1*L2-c1*L1+c2*d;
0 0 -c2 c2 -c2*d;
-c1*L2 c1*L1 c2*d+c1*L2-c1*L1 -c2*d c2*d^2+c1*L2^2+c1*L1^2];
K=[k1+k 0 -k1 0 -k1*L2;
0 k1+k -k1 0 k1*L1;
-k1 -k1 k2+2*k1 -k2 k2*d+k1*L2-k1*L1;
0 0 -k2 k2 -k2*d;
-k1*L2 k1*L1 k2*d+k1*L2-k1*L1 -k2*d k2*d^2+k1*L2^2+k1*L1^2];
%~1b
AZ=[zeros(5) eye(5);-inv(M)*K -inv(M)*C];
[vt1,D1]=eig(AZ); % with damp
D1=eig(AZ)
vt1
%~1c
[vt2,D2]=eig(K,M); %undamp
D2=eig(K,M)
vt2
% check orthogonal
vt2'*M*vt2
vt2'*K*vt2
%~1d
qs=[k*y0; k*y0*cos(w*t0)+c*y0*w*sin(w*t0) ;0;0;0];

qc=[c*y0*w; -k*y0*sin(w*t0)+c*y0*w*cos(w*t0) ;0;0;0];


Q=[-w^2*[M]+[K] -w*[C];w*[C] -w^2*[M]+[K]];
qq=[qs;qc];
YY=inv(Q)*qq;
a4=YY(4,:);
b4=YY(9,:);
figure(1)
subplot(2,1,1)
M4=(a4^2+b4^2)^0.5;
for ww=0:0.01:5
M4ww=subs(M4,ww);
plot(ww,M4ww)
hold on
grid on
end
title('Amplitude')
xlabel('w (rad/s)')
ylabel('Amplitude (m)')

subplot(2,1,2)
fi=atan(b4/a4);
for ww=0:0.01:5
fiww=subs(fi,ww);
plot(ww,fiww)
hold on
grid on
end
title('Phase')
xlabel('w (rad/s)')
ylabel('atan')

%%AME 521 Project Task2


clear;
clc;

Kengyu Lin USCID:9852103390

%=========================================================================
% AZ function
function y = AZ(t,z,Ma,Kb)
k1=5*10^5;
k2=5*10^5;
c1=3.6*10^3;
c2=3.6*10^3;
V0=18;
a=4.5;
Ka=[Kb+k1*(admfun(V0*t))'*admfun(V0*t)+k2*(admfun(V0*t+a))'*admfun(V0*t+a) k1*(admfun(V0*t))' -k2*(admfun(V0*t+a))'; -k1*(admfun(V0*t)) k1 0;k2*(admfun(V0*t+a)) 0 k2];
Ca=[c1*(admfun(V0*t))'*(admfun(V0*t))+c2*(admfun(V0*t+a))'*admfun(V0*t+a) c1*(admfun(V0*t))' -c2*(admfun(V0*t+a))';-c1*(admfun(V0*t)) c1 0;c2*(admfun(V0*t+a)) 0 c2];
A=[zeros(5) eye(5);-inv(Ma)*Ka -inv(Ma)*Ca];
y=A*z;
end
%==========================================================================
%admissible function
function y = admfun(x)
L=400;
y = [(1-cos(2*1*pi*x/L)) (1-cos(2*2*pi*x/L)) (1-cos(2*3*pi*x/L))];
end
%==========================================================================
% main
a=4.5;
m=2.5*10^3;
I=3.2*10^2;
k1=5*10^5;
k2=5*10^5;
c1=3.6*10^3;
c2=3.6*10^3;
V0=18;
p=8*10^2;
EI=7*10^8;
L=400;
%===== Ma
Mb=zeros(3);
for i=1:1:3
for j=1:1:3
Mbfun = @(x) p.*(1-cos(2.*i.*pi.*x./L)).*(1-cos(2.*j.*pi.*x./L));
Mb(i,j) = integral(Mbfun,0,L);
end
end
Mbb=[m/4+I/(a^2) m/4-I/(a^2);m/4-I/(a^2) m/4+I/(a^2)];
Ma=[[Mb] zeros(3,2);zeros(2,3) [Mbb]];
%===== Kb
Kb=zeros(3);

for i=1:1:3
for j=1:1:3
Kbfun = @(x)
EI.*((2.*i.*pi./L).^2*cos(2.*i.*pi.*x./L)).*((2.*j.*pi./L).^2.*cos(2.*j.*pi.*
x./L));
Kb(i,j) = integral(Kbfun,0,L);
end
end
% Ca Ka are martix function of t, so I put both in the AZ.m for doing the
% numerical solution
Z0=[0 0 0 0.02 0.05 0 0 0 0.6 -0.3]';
N=3000; % choose this number can be divide by 6, in order to find dt for
finding beam's displacement
tend=(L-a)/V0;
h=(L-a)/(V0*N);
z=Z0;
Z(:,1)=Z0;
k=1;
T(:,1)=0;
for t=0:h:tend %Runge-Kutta Method
f1=AZ(t,z,Ma,Kb);
f2=AZ(t+h/2,z+h/2*f1,Ma,Kb);
f3=AZ(t+h/2,z+h/2*f2,Ma,Kb);
f4=AZ(t+h,z+h*f3,Ma,Kb);
Z(:,k+1)=Z(:,k)+(h/6)*(f1+2*f2+2*f3+f4);
z=Z(:,k+1);
T(1,k+1)=t;
k=k+1;
end
figure(1)
subplot(2,1,1)
plot(T,Z(4,:),'r')
title('y1 displacement')
xlabel('time (s)')
ylabel('magnitude (m)')
grid on
subplot(2,1,2)
plot(T,Z(5,:),'b')
title('y2 displacement')
xlabel('time (s)')
ylabel('magnitude (m)')
grid on
%=======beam dispacement
k=1;
for i=1:500:3001
for dx=1:1:400
Wb(k,dx)=admfun(dx)*Z(1:3,i);
end

k=k+1;
end
dx=1:1:400;
figure(2)
subplot(3,2,1)
plot(dx,Wb(2,:))
title('beam displacement 1*dt')
xlabel('beam long (m)')
ylabel('magnitude (m)')
grid on
subplot(3,2,2)
plot(dx,Wb(3,:))
title('beam displacement 2*dt')
xlabel('beam long (m)')
ylabel('magnitude (m)')
grid on
subplot(3,2,3)
plot(dx,Wb(4,:))
title('beam displacement 3*dt')
xlabel('beam long (m)')
ylabel('magnitude (m)')
grid on
subplot(3,2,4)
plot(dx,Wb(5,:))
title('beam displacement 4*dt')
xlabel('beam long (m)')
ylabel('magnitude (m)')
grid on
subplot(3,2,5)
plot(dx,Wb(6,:))
title('beam displacement 5*dt')
xlabel('beam long (m)')
ylabel('magnitude (m)')
grid on
subplot(3,2,6)
plot(dx,Wb(7,:))
title('beam displacement 6*dt')
xlabel('beam long (m)')
ylabel('magnitude (m)')
grid on
%========y1 y2 impulsive load
addyy2=1.2/2.5;
for t=0:h:tend %Runge-Kutta Method
f1=AZ(t,z,Ma,Kb);
f2=AZ(t+h/2,z+h/2*f1,Ma,Kb);
f3=AZ(t+h/2,z+h/2*f2,Ma,Kb);
f4=AZ(t+h,z+h*f3,Ma,Kb);

Z(:,k+1)=Z(:,k)+(h/6)*(f1+2*f2+2*f3+f4);
if k==1500 %add impulsive load on y2' at x=L/2
Z(10,k+1)=Z(10,k+1)+addyy2;
end
z=Z(:,k+1);
T(1,k+1)=t;
k=k+1;
end

figure(3)
subplot(2,1,1)
plot(T,Z(4,:),'r')
title('y1 displacement')
xlabel('time (s)')
ylabel('magnitude (m)')
grid on
subplot(2,1,2)
plot(T,Z(5,:),'b')
title('y2 displacement')
xlabel('time (s)')
ylabel('magnitude (m)')
grid on

You might also like