-
Notifications
You must be signed in to change notification settings - Fork 22
/
vtb2_2.m
executable file
·38 lines (33 loc) · 1.15 KB
/
vtb2_2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function vtb2_2(m,c,k,wdr,F0,tf)
%VTB2_2 Particular solution of an underdamped single degree of freedom system.
% VTB2_2(m,c,k,wdr,F0,tf) plots the response of an underdamped single
% degree of freedom system to a sinusoidal input with amplitude F0 and
% frequency wdr. The argument tf is the total time of the simulation.
% The system is a mass m, damping c, and stiffness k.
% VTB2_2(zeta,w,wdr,f0,tf) plots the response of an underdamped single
% degree of freedom system to a sinusoidal input with amplitude f0 and
% frequency wdr. The argument tf is the total time of the simulation.
% The system parameters are the damping ratio zeta and natural frequency w.
% This statement determines which type of input format you are using.
if nargin==5
tf=F0;f0=wdr;wdr=k;w=c;z=m;
m=1;c=2*z*w;k=w^2;F0=f0;
end
t=0:.005*tf:tf;
f0=F0/m;
w=sqrt(k/m);
z=c/2/w/m;
if z>=1
disp('This system is NOT underdamped, sorry!')
else
A0=f0/sqrt((w^2-wdr^2)^2+(2*z*w*wdr)^2);
x=A0*cos(wdr*t-atan2(2*z*w*wdr,w^2-wdr^2));%(2.28)
aa=version;ll=length(aa);
plot(t,x)
grid on
xlabel('Time')
ylabel('Displacement')
title('Displacement versus Time')
end
%Automatically check for updates
vtbchk