Skip to main content
14-Alexandrite
November 15, 2022
Solved

ODE solve give very spiky response ?

  • November 15, 2022
  • 5 replies
  • 4239 views

To all

 

I am looking at the ODESolve with a “saw tooth” input (y’’) and I get a very spiky response – see attached (mcad 15 wsheet will follow)

Why is that?

Tried different time steps but always get this rather spiky response

 

Thanks

John

Best answer by AlanStevens

Works better as set of first order equations:

Eqns.png

 

Avoid numerical differentiation wherever possible!

 

Alan

 

5 replies

24-Ruby IV
November 15, 2022

Try to convert one 2-d ODE into two 1-st Odes!

25-Diamond I
November 15, 2022

Would suggest that you attach your worksheet.

Would adding more steps in odesolve (third, optional argument) be of help?

Maybe worth a try although i guess that the problem stems from the numeric derivations and not from the result of odesolve.

Hard to be of more hep without having the sheet to play with.

23-Emerald IV
November 15, 2022

 

I guess Amax=20 and tf=0.011. What are your values forLucMeekes_1-1668548279451.png and LucMeekes_2-1668548298092.png  ?

If they are 3 and 5 respectively I get:

LucMeekes_3-1668548496389.png

Success!

Luc

 

 

 

 

15-Moonstone
November 16, 2022

odesolve use to be mathcad's best solver. however, their statespace solver is much better. the help and quicksheets can get you started. if you want some example files, I can post them. the users here on the forum helped me get a pwm input working. i haven't tried a sawtooth wave but i expect it would handle it well. the nice thing about the statespace solver is it can handle a lot more inputs than odesolve can.

JXBWk14-AlexandriteAuthor
14-Alexandrite
November 16, 2022

can't find the option to edit original post ! attached mcad 15 worksheet.

The Prime 8 conversion is not quite working. Does not like the y''(t) notation

25-Diamond I
November 16, 2022

Still not perfect, but maybe its helps

Werner_E_0-1668605803881.png

Its interesting that even lowing the number of steps from the default 10^3 to 10^2 give a coarse but mainly spike-less result.

 

JXBWk14-AlexandriteAuthor
14-Alexandrite
November 16, 2022

Thanks. Yes. Have been playing with the number of time steps and it's almost as if 150-250 steps give the "best" results

No idea why numerically one gets all this spikes.

Maybe the transition back to zero be done in a zero time is creating some sort of infinity in the process

Maybe I'll try to have a the ramp-down i.e. max-back to zero in a very small time step