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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

11-Garnet

## Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

Hello Guys!

I want to analyse my circuit, using laplace transformation.

Step 1) First I have to generate a triangle waveform.

I have all informations given like peak-value, duty cycles, frequency, and so on.

I could obtain a triangle waveform by defining sections with the if-equation, according to the post from Werner:

My first idea was to multiply a sawtooth function with a rect function, but nevermind. I keep the solution from Werner I guess if the following Step 2) will work...

Another approach would be a fourier row to obtain the triangle shape. Maybe you have some older work / examples here for me?

Step 2-4) I want to make a Laplace Transformation from the triangle waveform, means: i(t) -> I(s)

--> is it posible with my function from Step 1) to do a laplace transformation, or do I have to go the approach with fourier rows?

(Step 3) Vout(s)=I(s)*G(s), with G(s) = Transfer-function of a circuit

(Step 4) Inverse Laplace Transformation Vout(s) -> vout(t) and plot

I am working with Prime 3.0

Best Regards

1 ACCEPTED SOLUTION

Accepted Solutions
23-Emerald III
(To:xyz123)

Here's an example, first your triangle:

Don't try to use the repetitive signal, due to the mod() function, the Laplace transform will not carry through:

Now we need G(s), to calculate X(s). As an example we take a simple Low-pass filter:

From here, apply the inverse Laplace transform to obtain x(t):

(Yes, it's a big expression)

And plot f(t) and x(t):

Success!
Luc

31 REPLIES 31
23-Emerald III
(To:xyz123)

Very first check: see if the Laplace transform likes an 'if'-statement. I know it deals with the Heaviside step function OK, but have my doubts about if...

Success!
Luc

23-Emerald III
(To:LucMeekes)

And even if you succeed in finding the Laplace transform of a triangular waveform, which, according to Spiegel "Laplace transforms":

for a triangle with amplitude A and period T and no offset, will be something like:

Then on trying to apply the inverse Laplace, you (may) get:

which means that the inverse Laplace isn't known.

Success!

Luc

21-Topaz II
(To:LucMeekes)

Sometimes the transformation or inversion is successful, adding the type of constants used, for example: assume, A = real, assume T> 0 etc ...

23-Emerald III
(To:-MFra-)

Sometimes...

I found another method to define a (symmetrical) triangular waveform:

Unfortunately the Laplace transform isn't found by Mathcad:

Luc

14-Alexandrite
(To:xyz123)

Here are a couple of handy documents showing how to generate and analyze waveforms with Mathcad.

24-Ruby V
(To:xyz123)

Shouldn't you replace t.3 in your definition of f(t) by T. After all t.3 seems to be a duration, not a time stamp.

As Luc already wrote, the symbolic "laplace" does not work with conditionals (if's).

I am also not sure about trunc and/or mod (which you would use to make a periodic signal) and the used units. After all the symbolics does not know anything about units and treats them as unknown variables.

Using Fourier would require you to trunc the row and would just be an approximation.

EDIT: I just gave it a try and redefined f(t) using the Heaviside function as suggested by Luc.

We can laplace transform f(t), but as soon as we use "floor" to make it periodic, the symbolic is not able to transform it in a usable way - you see the calls to a (non-existent in Prime) laplace-function in the result.

I haven't tried, but I guess that different ways to make the signal periodic (using the "mod"-function e.g.) will have no success, too and you will have to resort to other methods to solve your task. Maybe the pdfs of @-MFra- , posted by @Derbigdog  will be of help.

11-Garnet
(To:Werner_E)

So this makes really fun, I must admit.

The pdf´s attached above are great, but unfortunately does not help...

See my attachment below, I have played and tried out a lot.

The solution is actually in the F1-mathcad-help-menu. Mathcad will not return any useful solution without the further command "assume, ALL>0"!

I also cleared all defintions, unfortunately clear(ALL) does not work ... Nevermind.

Completly symbolic it looks like this:

...

Tomorrow will follow more ... 🙂

Best Regards

24-Ruby V
(To:xyz123)

You shouldn't "upgrade" to Prime 6 or any upcoming version.
Sooner or later the "legacy" symbolic (Mupad) will not be integrated anymore and the newly introduced symbolic isn't really ... competitive.

Remark: In Prime 6 you still have the option to switch between the two symbolic engines.

23-Emerald III
(To:Werner_E)

In that case: upgrade now to Prime 6 while it still lasts (and you can still use the MuPad symbolics). Two weeks from now you are maybe stuck with Prime 7 for an upgrade.

Success
Luc

20-Turquoise
(To:xyz123)

The next step is convolution of waveforms. i means 0.001s sampling,

11-Garnet
(To:ttokoro)

Hi ttokoro,

can you attach a screenshot of the function x(t) and g(t) of your example?

With my waveform above I have a non periodical signal. Just a single pulse. But it seems to work quite nice. I must verify the solution with a simulation in Spice.

20-Turquoise
(To:xyz123)

Number of input signal can change by as same as Werner_E posted.

If we have a impulse response, g(t), Mathcad can show the output signal waveform by using convolution even we can't write the equation of input function. (Just use the A/D signal data for input x(t).)

If we can write the both equations, convolution integral can show the output signal waveform.

can show the infinity input series response. It is well known as Z(jw) results.

23-Emerald III
(To:xyz123)

Here's an example, first your triangle:

Don't try to use the repetitive signal, due to the mod() function, the Laplace transform will not carry through:

Now we need G(s), to calculate X(s). As an example we take a simple Low-pass filter:

From here, apply the inverse Laplace transform to obtain x(t):

(Yes, it's a big expression)

And plot f(t) and x(t):

Success!
Luc

24-Ruby V
(To:LucMeekes)

We might not be able to Laplace-transform the periodic made signal, but at least we can repeat it a couple of times using a simple summation which the laplace command accepts.

But I guess that less simple filters might be a problem for invlaplace

23-Emerald III
(To:Werner_E)

Great idea Werner,

Luc

23-Emerald III
(To:xyz123)

And with another filter, you may get this:

Success!
Luc

23-Emerald III
(To:xyz123)

Found another way to build a triangle. But it's neither symbolic-proof, nor fast:

Success!
Luc

24-Ruby V
(To:LucMeekes)

In case you could not see the worksheet of the OP, as far as I understood it and depending on the sheet which was posted, the signal should look like this:

24-Ruby V
(To:xyz123)

In case "invlaplace" fails it may help to "simplify" beforehand:

11-Garnet
(To:Werner_E)

Hello Werner,

I want to reproduce your approach with a more complex filter. Please see the attachment.

But my prime 3.0 cannot really solve the final result x(t), and I cant find the issue.

- I can create a triangular waveform --> ok

- I can make a laplace transformation Y(s) --> ok

- I can make a multiplication of Y(s) * G(s), where G(s) is a more complex filter --> ok

- The inverse laplace transformation seems also to work to obtain x3(t)...

- The plot x3(t) does not work and I cannot find the issue. x(t) is not defined ... ?

Regards

23-Emerald III
(To:xyz123)

If I made no mistake then:

The Laplace transform of the triangular signal y starts with:

And with the actual component values the Laplace transform of the response is:

Transformed back to time domain we get x3(t) that starts with:

And the time-plot is:

Success!

Luc

11-Garnet
(To:LucMeekes)

Hello Luc,

it is clear and understandable what you do, thank you very much, but I cant reproduce your appraoch in my prime 3.0.

Can you try it with my attached sheet?

Best regards

23-Emerald III
(To:xyz123)

Unfortunately: no.

I do not have a Prime license, so I'm limited to Express (= No symbolics).

But I can show you what happens after more excitation signal:

Success!
Luc

24-Ruby V
(To:xyz123)

I guess that the error you see when trying to define x(t) is because you defined s as being the imaginary unit (why?).

But even if you delete this definition the result is to large to be displayed but it also cannot be evaluated numerically.

11-Garnet
(To:Werner_E)

Yes, the definition s:=sqrt(-1) was a test, but in any case my prime 3.0 cannot solve or display the function.

Thanks for trying out my prime 3.0 sheet!

It am very frustrated with prime 3.0. The tool is total crap. Can you please propose a good and satisfying mathcad version? I want to try it out.

23-Emerald III
(To:xyz123)

Your license for Prime 3 allows you to install Mathcad 15 on the same PC. For licensing you use the very same license file that you use(d) for licensing Prime. In most respects Mathcad 15 is more powerful than any version of Prime. There are a few goodies that Prime has, and Mathcad 15 doesn't.

If you (still) have a perpetual license, maintain that as long as possible. (Note that PTC now only sells yearly subscription licenses.)

Success!
Luc

P.S. I will not promise that Mathcad 15 will solve the problem as well as I managed to do with Mathcad 11...

24-Ruby V
(To:xyz123)

As you can see in the next picture it looks like the symbolic laplace operator fails because of the units. So you may give your sheet a try by stripping the units. Take care of the labeling! Both "t", the function argument and the argument of the laplace operator must have the exact same label (either both (-) or both "variable").

I have not tried but I could imagine that MC15 sufffers from the same problem as it uses the same symbolic engine as Prime 3 (and the versions up to P6).

But it looks like it got worse.

The new symbolic engine introduced in P6 (and its the only one available in P7) is even more critical as it needs to be told that t is greater than zero to be able to laplace transform the simple Heaviside step.

Thats also the reason why I did not succeed in laplace transforming a simple rectangle (at the right hand side you see the results given by the legacy symbolic Mupad).

So far I could not be bothered downloading and test driving Prime 7, so I don't know if the problem still is present there. After all they promised an improved symbolic, didn't they.

In case you don't know - Luc uses MC11 and this version used Maple as its symbolic engine which of course is (even though its a rather old and stripped down version) still far superior to the engines now used. So what he shows often does not work in newer versions.

Both Mathsoft (former owners of Mathcad) and Mathworks(ownern of MatLab) changed their symbolic engine from Maple to Mupad around 2006 (Maplesoft probably did not extend the license). Mathcad was bought by PTC soon after. The difference was, that MatLab bought muPad and so Mathsoft/PTC had to license the symbolic module from them. Thats also the reason PTC was eager to get rid of muPad and implement its own thing based on a free engine.

11-Garnet
(To:xyz123)

Hello guys,

although it was solved I dont want to create a new topic.

With a simple RC-lowpass is was possible to obtain a solution.

Now I try to multiply Iout(s) * G(s) to obtain Vout(s), but with a far more complex filter.

When i do it on the symbolic way, then Mathcad is calculating for a long time with a result "too large to display" ...

Well, I tried it then with functions instead of symbolic math and maybe I have found a solution here, but:

- Please check if i did it correctly

- I cannot plot the final function

- My goal is to obtain a voltage ripple on the output of the filter (peak-to-peak) ...

I attached the sheet. The first part of the sheet is the older topic where the current by itself was plotted.

For the new issue please scroll below to page 13 ++

Best regards!

23-Emerald III
(To:xyz123)

You should still be able to use the symbolic result, even if it's 'too large to display'.

Assign your symbolic result to a function such as:

Vout(t, Vin, R, C) := H(s, R, C) * Ltriangle(s, Vin) invlaplace -> <symbolic expression too large to display>

Then you can (or at least, should be able to), plot Vout(t, Vin, R, C) versus time t.

Success!
Luc

Announcements
Top Tags