I changed the code as followed:
refine = 1;
options = odeset('Refine', refine,...
'RelTol', 1e-5,'absTol',1e-5*ones(1,length(y_sym)),'Jacobian',@JacobiFun,'JConstant','no','Mass',MassFun,'MassSingular','no','MstateDependence','strong','OutputFcn',@odetpbar);
[t_up,y_up,te,ye,ie] = ode15s(@(t,y) ...
rocking_DGL(t,y,time_r,dt,ug,vg,Fss,Sys,y_sym),time_r,IC_rocking,options);
Where the function JacobiFun is defined as:
function dfdy = JacobiFun(t,y,time_r,dt,ug,vg,J,y_sym,Sys)
%This Function evaluates the Jacobi Matrix
r = Sys.r;
roh = Sys.roh;
A = Sys.A;
I = Sys.I;
ne = Sys.ne;
nnode = Sys.nnode;
ndof = nnode*3;
Le = Sys.Le;
E = Sys.E;
g = Sys.g;
EI = E*I;
EA = E*A;
%Interpolate Earthquake Excitation
i = floor(t/dt) + 1;
if i < length(time_r)
u = ug(i) + (t-time_r(i))/(time_r(i+1)-time_r(i))*(ug(i+1)-ug(i));
v = vg(i) + (t-time_r(i))/(time_r(i+1)-time_r(i))*(vg(i+1)-vg(i));
else
u = 0;
v = 0;
end
%Substitute Parameters
J = subs(J,y_sym,y);
J = subs(J,{sym('u'), sym('v')}, {u, v});
%Load State Space Representation of Problem
dfdy = double(J);
end
Where J is the Jacobi I already calculated before which is symbolic. When I try to start the solver it gives an Error:
Not enough input arguments.
Error in JacobiFun (line 4) r = Sys.r;
Error in ode15s (line 350) dfdy = feval(Jac,t,y,Jargs{:});
Why are there not enough arguments? I pass them with Sys!