Simple questions on Mechanical Vibrations

23 views (last 30 days)
For k = 100, c = 2 and m = 1 use Matlab to calculate ωn, ωd and ξ. and Solve the equation of motion for F = F0sin(ωt) where ω = 1 → 20 rad/s and F0 = 10 N and plot the maximum response at steady-state for each frequency.
%Part 2
%Equation of motion
clear all;
clc;
m=1;
c=2;
k=100;
F=0;
Force=[0;0;F];
M=[m 0 0;0 m 0;0 0 m];
K=[2*k -k 0;-k 2*k -k;0 -k k];
C=[2*c c 0;-c 2*c -c;0 -c c];
%Finding values
Z=zeros(3);
I=eye(3);
A=[C M;I Z];
B=[K Z;Z -I];
[V,D]=eig(B,A)
d=diag(D);
r=real(d);
im=imag(d);
wn=abs(d)
wd=im/-1
zeta=sqrt(1-(wd/wn)^2)
%Part 3
%2 equations: (K-Mw^2)a + Cwb=0, -Cwa+(K-Mw^2)=f
F0=10;
f=[0;0;F0];
z=[0;0;0];
w=1:0.1:20;
t=0:0.01:100;
for ii=1:length(w)
G=K-M.*w(ii)^2;
H=C.*w(ii);
T=[G H;-H G];
constants(:,ii)=T^(-1)*[z;f];
a(:,ii)= constants(1:3,ii);
b(:,ii)= constants(4:6,ii);
x=a(:,ii)*cos(w(ii)*t)+b(:,ii)*sin(w(ii)*t);
amp(:,ii)=sqrt((a(:,ii)).^2+(b(:,ii)).^2)
end
plot(w,x)
I am not sure why does MATLAB keeps on responding with vectors are not of the same length. Are there any ways to edit my solution/code?
I cant seem to plot the graph out =( please help!!!

Accepted Answer

David Goodmanson
David Goodmanson on 14 Nov 2018
Hi y z l, try
plot(w,amp)
which looks pretty good.

More Answers (1)

Keith Hekman
Keith Hekman on 29 Dec 2020
NOTE, you are missing the - in front of the c noted by the ""
C=[2*c "-"c 0;-c 2*c -c;0 -c c];

Categories

Find more on Vibration Analysis in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!