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

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

Square, Sine and PiceWise Linear Waves/Functions

Cornel
19-Tanzanite

Square, Sine and PiceWise Linear Waves/Functions

Hello Dear Friends,

Do you have any idea how to implement in Mathcad 15 the functions that generate the following graphs shown below?

Case 1:

CornelBejan_5-1615460678627.png

CornelBejan_4-1615460647797.png

CornelBejan_3-1615460608967.png

 

And if I change the parameters:

CornelBejan_7-1615460797770.png

CornelBejan_8-1615460820138.png

CornelBejan_26-1615462574787.png

 

 

Case 2:

 

a)

CornelBejan_11-1615461114717.png

CornelBejan_10-1615461094982.png

CornelBejan_14-1615461546057.png

 

 

b)

CornelBejan_16-1615461614655.png

CornelBejan_17-1615461626518.png

CornelBejan_15-1615461597509.png

 

 

c)

CornelBejan_20-1615461864632.png

CornelBejan_21-1615461877819.png

CornelBejan_19-1615461848108.png

 

 

Case 3:

 

CornelBejan_22-1615462100406.png

CornelBejan_24-1615462139898.png

CornelBejan_25-1615462475294.png

 

Thank you.
Best regards.

 

17 REPLIES 17
LucMeekes
23-Emerald III
(To:Cornel)

There are many ways that lead to Rome (or many another city).

What is your purpose with those functions:

- Do you just want to plot them?

- Do you need them to work numerically only?

- Are you going to use them symbolically?

- Do you intend to use them in (inverse) Fourier and/or Laplace transforms?

 

Luc

Cornel
19-Tanzanite
(To:LucMeekes)

CornelBejan_0-1615464976732.png


All 4 points listed by you, if it is possible.

The first 3 would be the main ones.
If it exists symbolically then by customizing the values ​​it can be evaluated numerically, and then it can be plotted. But I have no idea yet how to build these functions.

Fred_Kohlhepp
23-Emerald I
(To:Cornel)

All of your examples except this

Fred_Kohlhepp_0-1615467081730.png

can be simply achieved using either the Linterp or sine function along with some time limit constraints.

 

Let's see (from an Amethyst level member) a sheet at least showing your attempts.

Cornel
19-Tanzanite
(To:Fred_Kohlhepp)

I do not think that the rank can be an argument that resolves things or the rank is protected from the problems or questions:))), neither diploma of a faculty does not make you a successful/great engineer:) or at least an engineer who has unanswered questions.

Until now, whatever topic I opened I posted what I have done so far.
For this thread, I do not have a Mathcad file because I do not know how these functions can be realized, how they can be thought.
What I want to obtain is some function(s) in which I input these parameters (Vinitial, Von, Tdelay, Trise, Tfall, Ton, Tperiod, Ncycles) and so on for the other shapes/graphs within this topic, and at the end of the story, these functions help me to reach at the output graphs, as shown in the figures in this topic.

I don't think that's that simple to do. This is the reason for which I posted this message.

prop_design
15-Moonstone
(To:Cornel)

i have seen this done many times before on the old mathsoft forum. i don't recall how to do it though. i'm sure some of the current forum members would know how. unfortunately, it's not something built in to mathcad that is easy to access. you pretty much have to do it yourself. it was something i was hoping would eventually be implemented but never was. now ptc killed classic mathcad. so who knows what they will do with prime.

 

one obvious use of this that no one ever noticed was forcing functions for the ode solver. so mass spring damper systems. it would have been nice to have easy to access wave forms to load the system with.

LucMeekes
23-Emerald III
(To:Cornel)

Now come on.

Don't tell me that you are incapable of writing a function that produces a sine wave with given frequency, amplitude and offset as a function of time. A slight modification would add the starting phase, and with a little ingenuity you should be able to have it end after a certain number of periods of the sine.

 

Success!
Luc

Cornel
19-Tanzanite
(To:LucMeekes)

Ok.

sine and cosine waves of course are built in. i meant other types of wave forms. it would be nice to have a built in drop down box of all sorts of periodic waves that you would just specify the parameter to. really have no idea why this was neglected in the program in the first place.

Cornel
19-Tanzanite
(To:prop_design)

@LucMeekes  @Fred_Kohlhepp  @prop_design 

The sine and cosine waves were just for example to shown how to arrive with the case 2) point c).
It's not really about sine and cosine waves, but as you saw and intuited very well...it's about other types of waves like case 1 and case 3 (and perhaps other types of waves, more or less general types that are extensively used in various domains like electronics engineering).
And how to parameterize such waves to make life easier.
Good point.

Fred_Kohlhepp
23-Emerald I
(To:Cornel)

My apologies!

 

A place to start:  Prime 4.0 Express file

LucMeekes
23-Emerald III
(To:Cornel)

Well, here is a first shot, for the sine wave(s). Parameters as listed in your picture.

LucMeekes_0-1615497518460.png

It's Laplace transformable:

LucMeekes_1-1615497707113.png

And of course it plots all Spice's sine wave variants:

LucMeekes_2-1615497882102.png

Evidently, you can apply units as you like.

 

Luc

 

 

Werner_E
25-Diamond I
(To:Cornel)

Here is a function for the pulse wave for you to start with.
The function takes the same arguments in the same order as shown in your screenshot. However, the times that you show with arrows in the first picture "for clarity" seem to be quite inaccurate and misleading.

Werner_E_0-1615520985620.png

 

 

 

Werner_E
25-Diamond I
(To:Werner_E)

Here is a more compact version of the function posted above.
As you can see in the last example, symbolic operations won't work when used with units!
EDIT: See below.

Werner_E_0-1615555139294.png

EDIT My fault. The error occurs because I redefined t to be the range for plotting, should have used a different variable name (normally I use "t." in such cases as it looks like a normal "t".

Werner_E_0-1615587654554.png

So you see that the symbolic also works with units, but I can image that a useful result often will be demanded too much. As you should know the symbolic does not know anything about units and treats them as unknowns.

Cornel
19-Tanzanite
(To:Werner_E)

😍

 

Good.
Thank you very much.

I dare to ask if the following options would be possible:

CornelBejan_0-1615660328332.png

 

 

CornelBejan_1-1615660359731.png

 

 

CornelBejan_8-1615563171998.png

 

CornelBejan_0-1615564627671.png

 

CornelBejan_6-1615562554863.png

 

CornelBejan_7-1615563013043.png

 

Werner_E
25-Diamond I
(To:Cornel)

It seems that in your pics you are using Tfree for two different things!

The more different parts your signal should consist of, the more summands you would have to add to f(t) in the function and the more arguments your function will get.

Unfortunately we are not allowed to create functions in Mathcad which can be called with a variable number of arguments. So it may be a better option to provide vectors as arguments to the function. The first vector could consist of the times (T.1, T.2 etc in my function), the second may indicate the signal value (constant or ramp; nor sure how to implement that).

It should be easy to create that kind of function for the piecewise linear function PWL you showed in your initial post - first vector consists of times, second vector of the associated values.

Give it  a try and come back here if you got stuck.

EDIT: Actually all the signals you showed in your last post could be created by a PWL function by adding T.delay, T.period and N.cycles as arguments to repeat the signal a couple of times. The times you would have to provide would not be T.rise, T.on, T.fall, etc. but rather the sums of those. You may also consider to provide the times as given in the vector and let your function do the summing - similar to what I did in the second version of my function when I calculated T.1, T.2, etc. just to save space.

 

-MFra-
21-Topaz II
(To:Cornel)

Five pulse trains:

Five pulse trains.jpg

-MFra-
21-Topaz II
(To:Cornel)

All in one without reference files: Signals, data, Fourier analysis, sampling, and reconstruction of the signal with Shannon's theorem ( To reduce processing times, you must reduce N1_, for example, N1_ = 25.). See attached file.

Announcements

Top Tags