# How to add ticks for mesh?

I'm trying to reprocedue this plot with Mathematica and got some problems. x[t_] := 4 + 3 Cos[\[Pi] t] + 2 Cos[2 \[Pi] t] + Cos[3 \[Pi] t];
xa[t_] := 5 + 5 Cos[\[Pi] t]; Plot[{x[t], xa[t]}, {t, 0, 5},
GridLines -> Automatic, AxesOrigin -> {0, 0},
PlotStyle -> {Automatic, Directive[Dashed]}, Mesh -> {{0}},
MeshFunctions -> {x[#] - xa[#] &},
MeshStyle -> Directive[PointSize[0.03], Red]] 1. Why isn't a point at {0, 10}?
2. How would you add ticks 0, T, 2T, 3T, etc as in the image?

I believe that I can solve for the coordinate of points and add the ticks but I'm wondering if there is a simple way or that is the way to go?

• What is of interest is that Mesh didn't find all the intersections.
– Syed
May 21, 2022 at 4:38
• @Syed Mesh only work for cross-sectional intersection, that is it must change its sign. May 21, 2022 at 9:22

Use Solve or NSolve to find all the intersection points and use Epilog to add all the lines and points and ticks.

x[t_] = 4 + 3 Cos[π t] + 2 Cos[2 π t] + Cos[3 π t];
xa[t_] = 5 + 5 Cos[π t];
sol = DeleteDuplicates[Solve[{x[t] == xa[t], 0 <= t <= 5}, t]]
T = 2/3;
Plot[{x[t], xa[t]}, {t, 0, 5}, GridLines -> Automatic,
AxesOrigin -> {0, 0}, PlotStyle -> {Automatic, Directive[Dashed]},
Ticks -> None,
Epilog -> {Table[
Text[Style[ToString[i] <> "T", Bold], {i*T, 0}, {0, 2}], {i, 1,
7}], {Red, AbsolutePointSize, Point[{t, x[t]} /. sol]}, Green,
Line[{{t, x[t]}, {t, 0}}] /. sol}, PlotRangePadding -> {.1, .8}] 