Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
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
Solved! Go to Solution.
Works better as set of first order equations:
Avoid numerical differentiation wherever possible!
Alan
Try to convert one 2-d ODE into two 1-st Odes!
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.
I guess Amax=20 and tf=0.011. What are your values for and
?
If they are 3 and 5 respectively I get:
Success!
Luc
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.
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
Still not perfect, but maybe its helps
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.
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
Maybe I'll try to have a the ramp-down i.e. max-back to zero in a very small time step
No, I already tried and it didn't help.
Actually odesolve creates a couple of discrete points and performs some sort of interpolation behind the scenes to be able to provide a function. You may do the very same manually but use some sort of smoothing before applying interpolation.
I found the expsmooth seems to provide a good result and using it the numeric derivative seems to produce less spikes. You may also play around using different interpolation methods (lspline, pspline or maybe simple linear interpolation).
But as long as we are dealing with numeric methods (odesolve and the derivative) we have to reckon with artifacts of some kind.
MC15 sheet attached
OK, the true answer is probably this:
and stems from:
With those,
we can:
(note that these expression run much further to the right of the vertical grey line).
Compare to the numerical approximation by Odesolve:
Note the difference in z''<>Z'':
Success!
Luc
Thaks for the input. I naively assumed that this is an academic case - a single degree of freedom (spring-mass) subjected to a "ground" acceleration
If I got this right another input shape will work just fine. It still remains as to why that profile shape is giving odd answer
Not having the worksheet from which you have taken the pictures I may have to re-do bits of it as I 'll be interested to see the effect of a different wn value. much smaller
Thanks
Regards
John
Works better as set of first order equations:
Avoid numerical differentiation wherever possible!
Alan
Ah, apologies. I made one mistake, sign of y''. With the correct sign the result is:
And that results in:
And the comparison with the Odesolve result:
Now the results match better.
With that corrected, you were wondering about a lower value of wn, How about f=60 instead of 600.
And the comparison with Odesolve shows as:
I attach the Mathcad sheet. For you to run it in Mathcad 15 you will have to get the LODEsolve.xmcd file from https://community.ptc.com/t5/Mathcad/Toolbox-Solving-Ordinary-Differential-Equations-symbolically/m-... and replace the referenced file (LODEsolve.mcd) with that LODEsolve.xmcd.
I can only hope it runs as smoothly in your Mathcad 15 as it does in my Mathcad 11.
Success!
Luc