Get Help

Turn on suggestions

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

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Pulse function

Options

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

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

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-18-2019
03:43 PM

11-18-2019
03:43 PM

Re: Pulse function

I missed one error in the definition of your displacement function.

See the picture below or the attached sheet.

With this change its quite correct to use "Displacement(X(t))" in the second plot. But "Displacement(X(t))" should give you the very same result as "y(t)" 🙂

In the attached sheet I changed the displayed units to inch instead of feet as you give the measurement of the boards in inches. Not sure if this makes sense.

According the speed. Its the numerical integrations that take that much time. Every calculation of an integral means a lot of iterations to be done and this is done for every single point which is plotted. Thats the reason I suggested less values in the range variable t used for plotting. Prime should (not sure if it really does as we would like it to do) take advantage of more cores by multithreading and can use more RAM. But in my opinion "upgrading" to Prime would rather mean downgrading, considering the many missing features compared to Mathcad 15. I remember some threads here in the forum where multithreading was the cause for some troubles and it was suggested to turn it off. Can't remember the details, though.

But I suggest that you give it a try yourself. Download the trial version of Prime 6 (it will run in full mode for 30 days), convert your worksheet to Prime and see if the speed increases significantly.

Here the screen shot with the necessary change in the definition of "Displacement":

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-18-2019
07:22 PM

11-18-2019
07:22 PM

Re: Pulse function

I am doing as both Luc and Werner_E suggested. I have a trial version of 6 Prime, and I have the worksheet converted. I have the exact some model of the road surface (rectangular wave) as in the file that Werner_E provided. However, for some strange reason - even though it plots fine in Mathcad 15, when it plots in 6 Prime, it only shows the horizontal parts of the graph. The vertical parts are gone. Any idea how to get them to plot?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-19-2019
03:43 AM

11-19-2019
03:43 AM

Re: Pulse function

Worksheet(s) please...!

Luc

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-19-2019
04:50 AM

11-19-2019
04:50 AM

@LucMeekes wrote:

Worksheet(s) please...!

Luc

Here you are

I did no exact timing but it looks to me like calculations need much more time in Prime than in MC15

BTW, omitting the vertical line segments in a step function would be perfectly correct from a mathematical point of view but I understand that its undesirable for an engineer.

There is a simple cure, though.

My suggestion of a step width of 0,01 ms in the range was __far__ too low. It should read 0.01 s which is good enough for the plots.

The range 0s, 0.01ms .. 4.2s forces the plot to be evaluated at 4.2 * 10^5 positions. Mathcad could handle that many points (nearly half a million) but Prime seems to have different limits and it falls back to this strange looking plot where you could not change anything (line style, thickness, .. ) other than the colour.

Changing the range to read 0s,0.01 s .. 4.2 s gives us 421 points which is more than enough for this simple rectangular function. Changing the step width to 1 ms for 4201 points should be OK, too, of course.

Even simple 2D plots always were one of the many drawbacks in Prime and PTC was not able or willing to improve it. You may have noticed that there are not axis labels, no grid lines, the possibilities to customize the plot are much more limited and simple things like changing the axis limits are much more cumbersome.

In Prime 5 PTC has introduced a third party diagram component (look at the "calculate" ribbon for it). I don't like this add-on as its very slow and laborious to handle, does not scale correctly when used with a high resolution 4K display (making it nearly unusable) and does not support units (a no-go in a program like Mathcad/Prime).

Nonetheless, if you decide that you like Prime despite its drawbacks, you may give this plot component a try, too.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-21-2019
03:39 PM

11-21-2019
03:39 PM

Re: Pulse function

I am good with the solution that was proposed. However, the ultimate goal was to get a plot of the acceleration of b(t). And with the pulse function, I kept getting discontinuities. And it took 3 or more hours to calculate.

So i tried to generate a Fourier series, and I found one that worked, although it is an even function, and I needed an odd one. But for now, I went ahead and used it. I was trying to use an odesolve but I am having trouble understanding it. Take a look at my attached worksheet. Keep in mind that the goal is a plot of the second derivative of v(t) - that is v''(t). Can someone help me with the remainder of the worksheet to get me there?

Thanks,

Mike

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-21-2019
05:45 PM

11-21-2019
05:45 PM

Re: Pulse function

OK, where should I begin

.) For the equations in a solve block you have to use the (fat) boolean equal sign

.) y(t) is an already defined function you do not solve for. So you can't demand y(0)=0

.) The syntax for a system of ODEs is wrong. You have TWO functions to solve for (v and w) and so you have to use the syntax appropriate for a system of ODEs which you can easily look up in the help and the quicksheets provided.

.) Two typos (I guess): 1) c(x) which maybe should be v(x) ? and 2) k1 which sure should have been k.1

.) The bad news: A solve block with "odesolve" must be used unitless. Thats a real bad drawback of Mathcad and is one of the few improvements in Prime wher you can use units. So you may consider stripping off all units in the expressions in the solve block by dividing by the appropriate unit and later add the correct units to the solved for function. As this was too much hassle for me I simply stripped all the units from the very beginning 😉

.) With the initial conditions you provide both solution functions will be constant zero. So I changed one of them arbitrarily to w(0)=5 so you can see that the solve block is really working.

MC15 sheet attached.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-25-2019
07:14 AM

11-25-2019
07:14 AM

Re: Pulse function

Werner_E,

Thank you again for all your help. As always, you make it easy for me to understand. I tried to figure this out with the help but it was not obvious to me what was wrong. I do now see the fat equal signs, but unless you are looking for them they are easy to overlook. And I do not see anywhere that it is pointed out to use them. Did I miss it somewhere?

I still have on final question. Ultimately, what I need is v''(t) - acceleration. Do I just solve for that with odesolve instead of v(t), or do I need another solveblock, or what?

Thanks again,

Mike

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-25-2019
08:20 AM

11-25-2019
08:20 AM

Re: Pulse function

Werner_E,

Thanks, I think I figured it out. I just added an additional graph below your two and made it a plot of the second derivative of v(t) vs. t and it plots fine. So I guess it is already calculated in the Odesolve block, and plotting it shows me the results.

Thanks again do much for your time.

Mike

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-25-2019
11:10 AM

11-25-2019
11:10 AM

Re: Pulse function

v'' or any other function is not explicitely calculated in the solve block, but what a solve block with odesolve delivers basically is a number of points and the function simply interpolates between those points.

A derivative is only done numerically based on the points calculated. You can also integrate the function if you like - all done just numerically.

Its a pity that Mathcad can't solve ODEs symbolically, but of course numeric solutions often are good enough for our needs.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

11-26-2019
03:21 PM

11-26-2019
03:21 PM

Re: Pulse function

Werner,

I am attaching another model I have been working on (basically the latest one you posted, I have just modified some of the initial constants). I have a procedural question. Near the top of the worksheet is a variable named c2.

It is the value of a typical shock absorber like would be on a car. Currently I have it as a fixed value. However, in reality a shock absorber's damping value is a function of velocity (in my case, v(t). Since it is being used to calculate v(t), I assume I cannot make it a function of v(t)? If not, then can I at least make it one value if v(t) is positive and a different value if v(t) is negative? If so, how would I do that? Would I set it's as a matrix with one value for v(t)>0 and another for v(t)<0?

Thanks again for all your help.

Mike