cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Odesolve plot notable differences

JW_9781974
6-Contributor

Odesolve plot notable differences

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

5 REPLIES 5
Werner_E
25-Diamond I
(To:JW_9781974)

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.

 

 

JW_9781974
6-Contributor
(To:Werner_E)

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

Werner_E
25-Diamond I
(To:JW_9781974)

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) ?

 

LucMeekes
23-Emerald III
(To:JW_9781974)

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
20-Turquoise
(To:JW_9781974)

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

image.pngimage.pngimage.pngimage.png

image.png

Announcements

Top Tags