%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Nonlinear piezoelectric tuned vibration absorber (NPTVA) %
% --> dyna function (called by simu_nl_shunt %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dydt = dyna(t,y,pt,p,K_D,m,c,K_NL,e,C_eps,L,R,alpha,C_NL)
p = interp1(pt,p,t);
dydt = [ y(2);... % dynamics of the electromechanical system
(-c*y(2)-K_D*y(1)-K_NL*y(1)^3+e/C_eps*y(3)+p)/m;...
y(4);...
(-R*y(4)-1/C_eps*y(3)-1/C_NL*y(3)^3+e/C_eps*y(1))/(L*(1-alpha*y(4)^2))];