Expert help needed please for my Vibration assignment. I just want MATLAB code t
ID: 2086433 • Letter: E
Question
Expert help needed please for my Vibration assignment. I just want MATLAB code to plot. Just the code. Thanks! Expert help needed please for my Vibration assignment. I just want MATLAB code to plot. Just the code. Thanks! Find xit, x2t and plot using MATLAB Free-Vibration Response of a Two-Degree-of-Freedom System EXAMPLE 5.3 Find the free-vibration response of the system shown in Fig. 5.5(a) with k -30, k 5, k30 m = 10, m2=1, and q=c,-C3-0 fr the initial conditions x1(0)=1, i1(0)= (5.2) It can be seen that E. (5.1) contains terms involving x2 (namely, c2i2 and -k2x2). whereas Eq. (5.2) contains terms involving xi (namely,-c2x1 and-k2x). Hence they ?) 50) k i(c) IrTy m2 kyt2 cji Spring k3 under 1*1 my m2 e- Spring k1 under tension for +x Spring k2 under tension for2-x FIGURE 5.5 A two-degree-of-freedom spring-mass-damper system.Explanation / Answer
program 1 - -It is simple but can be used only for undamped system.
% This code solves n-degree of freedom free undamped vibration
%
clear;
M=input('Enter the mass matrix: ');
[n,o]=size(M);
if n~=o then
error('M matrix must be square!');
end
K=input('Enter the sti§ness matrix: ');
[n,o]=size(K);
if n~=o then
error('K matrix must be square!');
end
qu=0;
[u,l]=eig(K,M);
% Using ìeigîin this way allows us to subtract M*w^2
% from K, instead of I*w^2 (where I is the n by n identity
% matrix).
% The output from ìeigîgives unit-length eigenvectors.
% We need to scale them with respect to M.
%
for s=1:n
alfa=sqrt(u(:,s)'*M*u(:,s));
u(:,s)=u(:,s)/alfa;
end
x0=input('Enter the initial displacement column vector: ');
xd0=input('Enter the initial velocity column vector: ');
tf=input('Enter the Analysis time: ');
t=0:0.1:tf;
q=tf/0.1;
x=zeros(size(n,q));
% Applying Equation 7.183.
%
for j=1:n
w(j)=sqrt(l(j,j));
xt=u(:,j)*(u(:,j)'*M*x0*cos(w(j).*t)+u(:,j)'*M*xd0/...
w(j)*sin(w(j).*t));
x=x+xt;
end
% Plotting the modes in a subplot format.
% Note that, for more than 3 or 4 degrees
% of freedom, the plots will become nearly
% unreadable.
%
for r=1:n
subplot(n,1,r)
plot(t,x(r,:))
xlabel('Time, seconds');
ylabel(['Response x',num2str(r)]);
end
%%%%%%%%%%%%%%%%%%%%%%%
Program 2 multidegree using modal damping
%%%%%%%%%%%%%%%%%%%%%%%
% This code solves n-degree of freedom damped
% vibration using the modal analysis techniques
clear;
M=input('Enter the mass matrix: ');
[n,o]=size(M);
if n~=o
error('M matrix must be square!');
end
K=input('Enter the stifness matrix: ');
[n,o]=size(K);
if n~=o
error('K matrix must be square!');
end
% Giving the option to input damping via
% modal damping ratios or through the multiplying
% factors Cm and Ck.
%
fprintf('Press 1 to enter modal damping ratios, ')
qz=input('or anything else to enter Cm and Ck. ');
if qz==1
for iz=1:n
zeta(iz)=input(['Enter the damping for mode ',num2str(iz),': ']);
end
else
fprintf('Given that [c]=Cm[M]+Ck[K], ');
Cm=input('Enter the factor Cm: ');
Ck=input('Enter the factor Ck: ');
end
qu=0;
[u,l]=eig(K,M);
% Using ìeigîin this way allows us to subtract M*w^2
% from K, instead of I*w^2 (where I is the n by n identity
% matrix).
% The output from ìeigîgives unit-length eigenvectors.
% We need to scale them with respect to M.
%
for s=1:n
alfa=sqrt(u(:,s)'*M*u(:,s));
u(:,s)=u(:,s)/alfa;
end
x0=input('Enter the initial displacement column vector: ');
xd0=input('Enter the initial velocity column vector: ');
tf=input('Enter the Önal time: ');
t=0:0.1:tf; q=tf/0.1;
x=zeros(size(n,q));
for j=1:n
w(j)=sqrt(l(j,j));
% If modal damping ratios were entered, we already have
% a zeta vector. If not, we need to calculate from Cm
% and Ck.
%
if qz~=1
zeta(j)=0.5*(Cm/w(j)+Ck*w(j));
end
wd(j)=w(j)*sqrt(1-zeta(j)^2);
xt=u(:,j)*(u(:,j)'*M*x0*cos(w(j).*t)/sqrt(1-zeta(j)^2)+u(:,j)'*M*xd0/...
w(j)*sin(w(j).*t)/wd(j));
x=x+xt;
end
for i=1:n
x(i,:)=x(i,:).*exp(-zeta(i)*w(i).*t);
end
for r=1:n
subplot(n,1,r)
plot(t,x(r,:))
xlabel('Time, seconds');
ylabel(['Response x',num2str(r)]);
end
%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.