I am trying to do a sensitivity analysis using ParametricNDSolve for a hybrid system.

with the following event:

event4 = WhenEvent[θ[t] == θstep, {trans[t] -> 
      trans[t] + 2*Sin[-θ[t]], θ'[t] -> 
      Cos[-2*θ[t]]* θ'[t], θ[t] -> -1*θ[t],
      shift[t] -> -1*shift[t]}];

I am able to simulate the system and it behaves appropriately.

I generate the

pfun = ParametricNDSolveValue[....{y},{t, 0, 12}{k},]

and try to do pfun'[-1]

I get the following error

ParametricNDSolveValue::wenset: Warning: the rule θ[t]->-θ[t] will not directly set the state because the left-hand side is not a list of state variables.

ParametricNDSolveValue::nbnum1: The function value θ[0.]==-0.1 is not True or False when the arguments are {0.,1.,1.,1.,1.,1.,1.,-0.05,-0.433,0.,0.,0.,0.,0.,0.,0.,1.,0.,10.,10.,-100.,-40.,0.,-0.433,-0.816326,0.,0.,0.,0.,0.,0.,1.,0.,-1,1,-1,1,-0.433}.

ParametricNDSolveValue::nbnum1: The function value θ[8.14662*10^-6]==-0.1 is not True or False when the arguments are {8.14662*10^-6,1.,1.00008,1.00008,0.999185,0.999674,1.,-0.0500035,-0.433007,0.,0.,0.,0.,0.,0.,8.14662*10^-6,1.,0.,9.99185,9.99674,-99.974,-39.9495,0.,-0.433007,-0.816384,0.,0.,0.,0.,0.,0.,1.,0.000132895,-1,1,-1,1,-0.433}.

Could you please tell me what is going on?

  • 1
    $\begingroup$ Could you give a full example, including the differential equations? $\endgroup$ – Chris K Aug 9 '19 at 20:31