If I have “s” which pertains to the results from NDSolve, how can I export the results to excel?
I require the numerical values of “x” and the values for “t”
s = NDSolveValue[sys, x, {t, 0, tf}]
Furthermore I am not sure how Mathematica deals with it’s time steps, I would assume that the time steps are regular as produced by the ODE solvers in Matlab, however if the time steps are irregular, how can I get raw data with a regular time step?
Thus far I have figured out the that the raw data can be attained using the below
Is your difficulty the export itself, or is it getting a table of values?
In your example, the value of s should be an InterpolatingFunction. That’s just like any other function that can be applied to arguments. So, if you wanted a table of values for your range {0, tf}, then you could just evaluate s for values in that range spaced at whatever intervals you want. Like this (let’s say tf is 10 and you want your spacing to be .5):
Table[{x, s[x]}, {x, 0, 10, .5}]
Or if you want to specify the number of samples (e.g. 35) instead of spacing: