Hello!
I would like to plot a graph for ball that was thrown from (H1+H2) in the air diagonaly and when it hits the water at hight H1 resistance coefficent changes from ka (resistance coefficent of air) to kw (resistance coefficent of water)
How can I do it? I tried using function WhenEvent like this:
m = 0.5;
g = 9.81;
v0 = 10;
H1 = 10.;
H2 = 5.;
kw = 1; (*coeficient of fluid*)
ka = 0.1; (*coeficient of air*)
s = NDSolve[{
v = Sqrt[x'[t]^2 + y'[t]^2];
m x''[t] == -kz v x'[t],
m y''[t] == -m g - kz v y'[t],
x'[0] == v0, x[0] == 0, y'[0] == 0, y[0] == H1 + H2,
WhenEvent[y[t] <= H1, Replace [ka, ka -> kw]]},
{x, y}, {t, 0, 10}];
{x[t], y[t]} = {x[t], y[t]} /. s[[1]]
ParametricPlot[{x[t], y[t]}, {t, 0, 6}, AxesLabel -> {"x[mm]", "y[mm]"}, PlotRange -> {{0, 10}, {0, 16}}]
Thank you!
