Hi, Phil,
Not sure what is wrong with your code (you forget to include definitions for m and k1).
Here is a simple example for 2 uncoupled harmonic oscillators:
DATA = Reap[
NDSolve[
{
x1'[s] == y1[s],
y1'[s] == - 16. x1[s],
x2'[s] == y2[s],
y2'[s] == - 25. x2[s],
x1[0] == 0.0,
y1[0] == 1.0,
x2[0] == 1.0,
y2[0] == 0.0,
WhenEvent[Mod[s,1.] == 0.,Sow[{x1[s],x2[s]}]]
},
{},
{s,0,1000},
MaxSteps -> Infinity,
Method -> {
"ImplicitRungeKutta",
"DifferenceOrder" -> 10,
"Coefficients" -> "ImplicitRungeKuttaGaussCoefficients",
"ImplicitSolver" -> {
"Newton",
AccuracyGoal -> MachinePrecision,
PrecisionGoal -> MachinePrecision,
"IterationSafetyFactor" -> 1
}
}
]
][[2,1]] // Transpose ;
ListLogPlot[Abs[Fourier/@DATA],PlotRange->All,Frame->True,ImageSize-> 500]
Note, that I do not use interpolating function, but WhenEvent[] function to generate trajectory sample at s = 1,2, ...
I.M.