You are on page 1of 2

Ejercicio de clase No.

1 Vibraciones libres:

Código en Matlab
% vibraciones libres no amortiguadas
k= 2000; % N/m
m= 10; %kg
xo= 0.1; %m
xodot=2; % m/s
t= (0:0.02:4); %s

% nat freq
omega_n=(k/m)^0.5

%% first solution
% response
x=xo.*cos(omega_n.*t)+xodot/omega_n.*sin(omega_n.*t);
figure (1)
plot(t,x)
xlabel('t (s)')
ylabel('x (m)')

figure (2)
plot(t,xo.*cos(omega_n.*t),'b')
hold on
plot(t,xodot/omega_n.*sin(omega_n.*t),'r')
xlabel('t (s)')
ylabel('x (m)')
legend('cos component','sin component')
title('Contributions of the cosine and sine components of x(t)')

%% second solution
A=(xo^2+(xodot/omega_n)^2)^0.5;
phi=atan(xodot/(xo*omega_n));
x2=A*cos(omega_n.*t-phi);
figure (1)
hold on
plot(t,x2,'r--')
xlabel('t (s)')
ylabel('x (m)')

%% third solution
Ao=(xo^2+(xodot/omega_n)^2)^0.5;
phio=atan((xo*omega_n)/xodot);
x3=Ao*sin(omega_n.*t+phio);
figure (1)
hold on
plot(t,x3,'k*')
xlabel('t (s)')
ylabel('x (m)')
legend('1st sol','2nd sol','3rd sol')
title('Three solutions for x(t)')

You might also like