function x_dot = example3(t,x,fext,param)
% Example 3 - Dynamic Problem of One Degree of Freedom
% (The function 'example3' in this file is called by 'example3_sim.m')
%
% Department of Civil and Environmental Engineering
% Duke University
% Siu Chung Yau, Henri P. Gavin, January 2006


displ = x(1);   % displacement
veloc = x(2);   % velocity
z     = x(3);   % non-dimensional parameter of the hysteretic force

m  = param(1);  % mass
k  = param(2);  % stiffness
c  = param(3);  % dampling coefficient
fy = param(4);  % yield force
ry = param(5);  % yield displacement

accel = (-k*displ - c*veloc - fy*z + fext)/m ; 
z_dot = (1.0 -  z^2*(0.5*sign(z*veloc) + 0.5))*veloc/ry ;

x_dot = [ veloc ;    % velocity
          accel ;    % acceleration
          z_dot ];   % time derivative of the dimensionless Bouc-Wen variable

% ----------------------------------------- example3.m  January 23 2006
