cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Pulse function

SOLVED

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":

B.png

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?

Re: Pulse function

Worksheet(s) please...!

 

Luc

Re: Pulse function


@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.

B1.png

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.

B2.png

 

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.

 

 

View solution in original post

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

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.

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

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

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.

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

 

Announcements