Skip to main content
15-Moonstone
April 20, 2021
Solved

output of odesolve

  • April 20, 2021
  • 18 replies
  • 7533 views

is there a way to convert the odesolve output to a matrix, so that the max and min can be found. apparently the odesolve output is a function. i attached a worksheet. i want to convert t and x to matrices.

Best answer by Werner_E

@prop_design wrote:

is there a way to convert the odesolve output to a matrix, so that the max and min can be found. apparently the odesolve output is a function. i attached a worksheet. i want to convert t and x to matrices.


How about

Werner_E_0-1618902721650.png

Of course you could use any vector "tvec" as long as its elements are all in the range from 0 to tmax. You may simply replace tstep by any other value.

 

 

18 replies

Werner_E25-Diamond IAnswer
25-Diamond I
April 20, 2021

@prop_design wrote:

is there a way to convert the odesolve output to a matrix, so that the max and min can be found. apparently the odesolve output is a function. i attached a worksheet. i want to convert t and x to matrices.


How about

Werner_E_0-1618902721650.png

Of course you could use any vector "tvec" as long as its elements are all in the range from 0 to tmax. You may simply replace tstep by any other value.

 

 

15-Moonstone
April 20, 2021

thanks werner,

 

i had been trying to use vectorize but it wasn't working for me. i'll try again. i must have been missing something.

23-Emerald I
April 21, 2021

Before there was ODEsolve there were the line solvers, (Adams, rkfixed, Rkadapt, Bulstoer, and Radau).

 

rkfixed et al are still there, and the output is the matrix you're looking for.

 

ODEsolve automated one of the line solvers and fit a curve to the points.

 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
15-Moonstone
April 21, 2021

thanks fred,

 

i remember those days. i remember keeping up with the changes in the solvers. i don't recall the output differences though. i'm forgetting a lot. i actually like the odesolve output though. having it be a function makes some things a lot easier. but then you need to convert it, which had me stuck. thanks to werner for unsticking me. the state space output is in a matrix and it seems like the last column of the matrix is velocity. however, it doesn't match up with the velocity you get using the time and displacement output. so i'm still confused there. but all of my other questions were answered by forum users. so many thanks to all. i have the examples posted. i have been updating them a lot and updating the post.