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?


closed as off-topic by xzczd, m_goldberg, Michael E2, C. E., MarcoB Aug 13 at 2:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – xzczd, m_goldberg, Michael E2, C. E., MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

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