Lab 2
Lab 2
Lab 2
LAB # 2
Prepared By :
Uzma Perveen
o Where;
o According to the laws of physics
-------------------- (1)
o In reality, the spring force and/or the friction force can have
a more complicated expression or could be represented by
a graph or data table.
For instance, a nonlinear spring can be designed (see
figure 2.1) such that
o In such case, Equation (1) becomes
-------------------- (2)
------------------------ (3)
Or
------------------------ (4)
function dvdt=cruse_speed(t,v)
M=750;
B=30;
Fa=300;
%dv/dt=(Fa/M)-(B/M)v
dvdt=Fa/M-B/M*v;
2. create a new MATLAB m-file and write
v0=0;% (initial speed)
[t,v]=ode45('cruse_speed',[0 200],v0);
plot(t,v);
grid on;
title('cruise speed time response to a constant fraction force Fa(t)')
Mass-Spring System Example:
o Assume the spring force Fs(x) = k xr(t). The mass-spring
damper is now equivalent to
function dXdt=mass_spring(t,X)
M=705; % (Kg)
B=30; % (Nsec/m)
Fa=300; % (N)
K=15; % (N/m)
r=1; % dX/dt
dXdt(1,1)=X(2);
dXdt(2,1)=-B/M*X(2)-K/M*X(1)^r+Fa/M;
2. In MATLAB write
>>[t,X]=ode45('mass_spring', [0 200],X0);
Exercise
1. Plot the position and the speed in separate graphs.