The first error : Derivative input 1 of 'm_LuGre_h_simpleblock/LuGre model2/Subsystem/Subsystem2/Integrator1' at time 3.155443620884047e-030 is Inf or NaN. Stopping simulation. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances). And another error is_ Index expression out of bounds. Attempted to access element 3. The valid range is 1-1.
Function 'LuGre model2/Subsystem/Subsystem2/oil_film_thickness_h' (#25.148.149), line 7, column 10: "3" Launch diagnostic report. 1 fcn 7 Index expression out of bounds. Attempted to access element 3. The valid range is 1-1. 2 fcn 15 Index expression out of bounds. Attempted to access element 2. The valid range is 1-1. 3 fcn 15 Undefined function or variable 'y'. The first assignment to a local variable determines its class This error is in embedded matlab function before entering the integrator block , actually i need to use the result of the outlet of integrator block as input to embedded matlab function. 1 function y = fcn(u) 2 v=abs(u(1)); 3 K_dec_p=1/0.25; %=1/to_hp 4 K_dec_n=1/1; %=1/to_hn 5 K_rest=1/40; %=1/to_ho 6 if v>1e-3; 7 if(u(3)<=u(2)) 8 T=K_dec_p; 9 else 10 T=K_dec_n; 11 end 12else 13 T=K_rest 14end 15y=T*(u(2)-u(3))