I want to plot a parametric 3D plot from the following ParametricNDSolve code:
ClearAll["Global`*"]
z[t_] := y[t] - l Cos[φ[t]];
n[t_] := k Abs[z[t]]^(3/2) - c z'[t];
R = 0.01395;
k = 1500000000;
c = 0;
g = 9.81;
μs = 0.3;
μk = 0.301;
i = 8.784*10^-6;
m = 0.035;
l = R Sqrt[2 (1 + Sin[1/2 π - 2*f])];
a = ParametricNDSolve[
{m y''[t] == n[t] - m g,
φ''[
t] == (n[t] l Sin[φ[t]] +
m x''[t] l Cos[φ[t]])/i,
x''[t] ==
If[(x[t] - l*φ[t] == 0) // Evaluate ,
l (φ''[
t] Cos[φ[t]] - φ'[t]^2 Sin[φ[
t]]) // Evaluate, μk *n[t]/m // Evaluate],
y[0] == l*Cos[f],
y'[0] == -2.9, φ[0] == f, φ'[0] == h,
x[0] == 0, x'[0] == 0,
WhenEvent[z[t] == 0 // Evaluate ,end=t; "StopIntegration";]}, {y'[
t]}, {t, 0, 0.01}, {f, h},
Method -> {"EquationSimplification" -> "Residual",
"DiscontinuityProcessing" -> False}, AccuracyGoal -> Automatic,
WorkingPrecision -> MachinePrecision, MaxSteps -> 100000000,
PrecisionGoal -> Automatic]
The code works. However, when I tried to plot y'[end] against f and h using the following code: ParametricPlot3D[y'[end], {f, 0, 0.7}, {h, 0, 10}]
It outputs an empty graph without any error message.
[![enter image description here][1]][1]
I think the problem is because of the end=t in my WhenEvent. However, I have no idea how to fix it.
Please send help. Thanks a lot. [1]: https://i.sstatic.net/gN7PN.png