Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - Learn all about the Community Ranking System, a fun gamification element of the PTC Community.
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Nov 15, 2022
10:57 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 15, 2022
10:57 AM

ODE solve give very spiky response ?

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.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Nov 17, 2022
04:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 17, 2022
04:50 AM

Works better as set of first order equations:

Avoid numerical differentiation wherever possible!

Alan

13 REPLIES 13

Nov 15, 2022
01:25 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 15, 2022
01:25 PM

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

Nov 15, 2022
03:33 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 15, 2022
03:33 PM

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.

Nov 15, 2022
04:43 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 15, 2022
04:43 PM

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

Nov 16, 2022
03:13 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 16, 2022
03:13 AM

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.

Nov 16, 2022
04:18 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 16, 2022
04:18 AM

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

Nov 16, 2022
08:36 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 16, 2022
08:36 AM

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.

Nov 16, 2022
08:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 16, 2022
08:58 AM

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

Nov 16, 2022
09:57 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 16, 2022
09:57 AM

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

Nov 16, 2022
10:42 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 16, 2022
10:42 AM

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

Nov 17, 2022
03:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 17, 2022
03:58 AM

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

Nov 17, 2022
04:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 17, 2022
04:50 AM

Works better as set of first order equations:

Avoid numerical differentiation wherever possible!

Alan

Nov 17, 2022
07:50 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 17, 2022
04:20 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Nov 17, 2022
04:20 PM

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