%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 抵抗力が運動摩擦係数μによる場合の減衰振動方程式
% d^2x/dt^2 + sgn( dx/dt )μg + ω0^2 x = 0
% の定義
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dxdt = MuVibration(t, x, mu, omega0)
%VANDERPOLDEMO Defines the van der Pol equation for ODEDEMO.
%
% Copyright 1984-2002 The MathWorks, Inc.
% $Revision: 1.2 $  $Date: 2002/06/17 13:20:38 $
%
% modified by T. Samejima
%%%%%% 引数 %%%%%%
% t 時間
% x 状態量
%    x(1)がx(振動変位)
%    x(2)がdx/dt(振動速度)
%    を表している
% mu μ(運動摩擦係数)
% omega0 ω0 = sqrt(k/m)(固有角振動数)
%%%%%% 戻り値 %%%%%%
% dxdt xの1階微分値
%    dxdt(1)がdx/dt(= x(2))
%    dxdt(2)がd^2x/dt^2(= - sgn( dx/dt )μg - ω0^2 x)
%    を表している



gg = 9.8 ; % 重力加速度



dxdt = [x(2); -sign(x(2))*mu*gg - omega0^2*x(1)] ;
