Skip to main content
7-Bedrock
October 27, 2023
Question

Odesolve plot notable differences

  • October 27, 2023
  • 3 replies
  • 1613 views

The plot is changing enormously when ode solve is used. Any suggestions? 

3 replies

25-Diamond I
October 27, 2023

odesolve divides the interval by default into 10^3 steps.

If the interval runs from 0 to 6 as in your first example, this means timestep is 0.006

But if you increase the interval by the factor 500 as in your last example (t runs from 0 to 3000), the timestep increases by the same factor and is now 3. Of course this usually yields a very inaccurate result.

Solution could be to increase the default value of 10^3 steps - its the fourth (optional) argument of the odesolve function.

Werner_E_1-1698434439282.png

 

Feel free to increase the value significantly more for more precision at the higher values of t.

 

 

7-Bedrock
November 7, 2023

I tried and it worked however, it is not working with the other equations does this needs to be changed? 

25-Diamond I
November 7, 2023

My best guess is that you confuse milliseconds with seconds and you don't see it because no units are used.

When you solve your ODEs or you draw cos(20+0.01t), what do you expect to see?

 

I also don't see a peak at 22,6 here - where do you see that value?

Werner_E_0-1699377631098.png

Furthermore the result is much to imprecise because of the far too small numer of steps vs. the large interval from 0 to 200

here is a more precise result

Werner_E_1-1699377714222.png

Can't be clearly seen as its definitly a high frequency signal.

Again, maybe you meant 0.2 and not 200 for the end value (milliseconds instead of seconds) ?

 

23-Emerald IV
October 29, 2023

I guess you (want to) know that the solution to your ode is:

M(t) = cos (t*√3) + √(4/3) * sin(t*√3).

 

Success!
Luc

ttokoro
21-Topaz I
21-Topaz I
October 30, 2023

As already masters say, it needs number 10^4.

image.pngimage.pngimage.pngimage.png

image.png

t.t.