Professor Diomar Cesar Lobao

Universidade Federal Fluminense-Volta Redonda, RJ, Brasil

Diomar Cesar


Dept. Ciências Exatas - Exact Science Dept.

Search

odesmd.m

function fvec = odesmd(t,x);
% RHS of ODE for forced SDOF spring-mass-damper system
%
% The state vector x contains:
%    x(1) = velocity
%    x(2) = position
%
% The output vector contains:
% fvec(1) = acceleration
% fvec(2) = velocity

m = 100;         % mass
c =  50;         % damping coefficient
k = 1000;        % spring constant
omega = 5;       % forcing frequency (rad/s)
F0 = 0;       % forcing magnitude

F = F0*sin(omega*t);  % forcing function

fvec = zeros(2,1);
fvec(1) = (F - c*x(1) - k*x(2))/m;
fvec(2) = x(1);
Skip to content