Simple questions on Mechanical Vibrations

6 Ansichten (letzte 30 Tage)
yung zhen lek
yung zhen lek am 13 Nov. 2018
Beantwortet: Keith Hekman am 29 Dez. 2020
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!!!

Akzeptierte Antwort

David Goodmanson
David Goodmanson am 14 Nov. 2018
Hi y z l, try
plot(w,amp)
which looks pretty good.
  1 Kommentar
yung zhen lek
yung zhen lek am 14 Nov. 2018
Hey, thanks a lot for your help =) really saved my life

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Keith Hekman
Keith Hekman am 29 Dez. 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];

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by