Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
The plot is changing enormously when ode solve is used. Any suggestions?
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.
Feel free to increase the value significantly more for more precision at the higher values of t.
I tried and it worked however, it is not working with the other equations does this needs to be changed?
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?
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
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) ?
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
As already masters say, it needs number 10^4.