# Strange plot artifacts when plotting the underdamped oscialltor solution

I'm plotting something trivial; the solution to an underdamped harmonic oscilator: $$x(t) = A_{0} \cos(\omega t) e^{-t/\tau}$$ In MM speak I say: xOft[A0_, v_, T_, t_] = A0 Cos[2 Pi v t] Exp[-t/T]

Plotting with: Plot[xOft[1.4*10^-8, 29616123, 441, t],{t,0,1000}] produces,

Can anyone explain why MM produces such a strange plot for such a simple function? In the example above I scaled the $$y$$-axis with $$10^{8}$$ to check if it was a scaling issue...seemingly not. I want to make sure that this model is stable in MM before I do other things to it.

So I'd like to check:

• If this is just a plot issue, why and how can we get rid of it?
• If it is a real representation of the function, why is MM producing this result?

Thanks

• Moiré-effect. Increase PlotPoints. – Henrik Schumacher Feb 10 at 20:44
• And MaxRecursion option: MaxRecursion -> 12, PlotPoints -> 100 – Bob Hanlon Feb 10 at 22:22
• Thanks for both answers! If you have time could one of you add an answer with a short explanation so I can accept and assign credit? – QuantumPenguin Feb 10 at 22:24
• It is acceptable on this forum to answer your own questions. – Bob Hanlon Feb 10 at 22:31

xOft[A0_, v_, T_, t_] = A0 Cos[2 Pi v t] Exp[-t/T];


The artifacts that you observed are due to the function being under-sampled in the Plot. You can increase the sampling by increasing the number of initial sampling points (PlotPoints) and increasing the maximum number of recursive subdivisions that can be used (MaxRecursions). These increases will naturally slow down the plotting.

Plot[xOft[1.4*10^-8, 29616123, 441, t], {t, 0, 1000},
MaxRecursion -> 12, PlotPoints -> 100]


Or interactively,

Manipulate[
Plot[xOft[1.4*10^-8, 29616123, 441, t], {t, 0, 1000},
MaxRecursion -> mr, PlotPoints -> pp],
{{pp, 100, PlotPoints},
{Automatic, 25, 50, 100, 150, 200, 500}},
{{mr, 12, MaxRecursion},
{Automatic, Range[5, 15]} // Flatten}]