Skip to main content
12-Amethyst
February 16, 2021
Solved

Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

  • February 16, 2021
  • 7 replies
  • 16871 views

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:

https://community.ptc.com/t5/PTC-Mathcad/Plots-for-Conditional-Function/td-p/124048

 

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

  

Best answer by LucMeekes

Here's an example, first your triangle:

LucMeekes_0-1613570249687.png

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

LucMeekes_1-1613570345200.png

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

LucMeekes_2-1613570389440.png

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

LucMeekes_3-1613570708184.png

(Yes, it's a big expression)

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

LucMeekes_0-1613570849463.png

Success!
Luc

7 replies

23-Emerald IV
February 16, 2021

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

LucMeekes_0-1613491734828.png

Success!
Luc

23-Emerald IV
February 16, 2021

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

LucMeekes_0-1613499862037.png

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

LucMeekes_2-1613500286884.png

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

LucMeekes_3-1613500356438.png

which means that the inverse Laplace isn't known.

 

Success!

Luc

 

 

 

21-Topaz II
March 16, 2021

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

Derbigdog
15-Moonstone
February 16, 2021

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

 

25-Diamond I
February 16, 2021

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.

Werner_E_0-1613497437168.png

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.

Werner_E_0-1613497954599.png

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.

 

 

xyz12312-AmethystAuthor
12-Amethyst
February 16, 2021

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:

 

DM123_0-1613504880923.png

...

DM123_0-1613505270382.png

 

 

 

Tomorrow will follow more ... 🙂

 

Best Regards

 

25-Diamond I
February 16, 2021

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.

Werner_E_0-1613509808760.png

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

 

23-Emerald IV
February 16, 2021

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

LucMeekes_0-1613514438743.png

 

Success!
Luc

25-Diamond I
February 17, 2021

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:

Werner_E_0-1613531526615.png

 

25-Diamond I
February 17, 2021

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

Werner_E_1-1613593234279.png

 

 

xyz12312-AmethystAuthor
12-Amethyst
March 15, 2021

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 IV
March 15, 2021

If I made no mistake then:

LucMeekes_0-1615846992945.png

The Laplace transform of the triangular signal y starts with:

LucMeekes_1-1615847099599.png

Your filter is:

LucMeekes_2-1615847189331.png

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

LucMeekes_3-1615847252953.png

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

LucMeekes_4-1615847341559.png

And the time-plot is:

LucMeekes_5-1615847373696.png

Success!

Luc

xyz12312-AmethystAuthor
12-Amethyst
March 11, 2021

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

 

DM123_0-1615497761756.png

 

 

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 IV
March 11, 2021

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

1-Visitor
May 25, 2021

hi

 

I tried this.

 

Andy_Chen_0-1621954249823.pngAndy_Chen_1-1621954268675.png

 

23-Emerald IV
May 25, 2021

Please (please please) attach your Prime worksheet. And state your problem (if any)..

 

Success!
Luc