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

Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

SOLVED
DM123
Granite

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:

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

  

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

View solution in original post

31 REPLIES 31

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

 

 

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

Sometimes...

LucMeekes_0-1615880117734.png

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

LucMeekes_1-1615880239820.png

Unfortunately the Laplace transform isn't found by Mathcad:

LucMeekes_2-1615880273933.png

 

Luc

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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.

 

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

 

Tags (1)

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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.

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

image.pngimage.pngimage.pngimage.png

Tags (1)

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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. 

 

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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. 

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

 

 

image.pngimage.pngimage.pngimage.pngimage.png

image.pngimage.png

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

View solution in original post

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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.

Werner_E_0-1613573400351.png

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

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

Great idea Werner,

 

LucMeekes_0-1613577615742.pngLucMeekes_1-1613577666291.pngLucMeekes_2-1613577696290.png

Luc

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

And with another filter, you may get this:

LucMeekes_2-1613571876387.png

Success!
Luc

 

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

LucMeekes_0-1613514438743.png

 

Success!
Luc

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

Werner_E_1-1613593234279.png

 

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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:

LucMeekes_0-1615933239547.png

Success!
Luc

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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.

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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.

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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.

To download and install Mathcad 15, look in the Mathcad Installation section of this forum: https://community.ptc.com/t5/PTC-Mathcad-Installation/All-About-Mathcad-Software-Installation/m-p/70... (Use the Mathcad 15 trial installation, and license it with your Prime license file)

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

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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

Werner_E_0-1616072182896.png

 

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.

Werner_E_0-1616073477117.png

 

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

Werner_E_2-1616072715026.png

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.

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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!

 

Re: Creation of Triangle Waveform and Circuit Analysis with Laplace Transformation

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
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."