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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Unable to plot inverse laplace transform waveform

SU_10542991
4-Participant

Unable to plot inverse laplace transform waveform

Hi

Please find the attached mathcad prime worksheet. I am trying to plot Vo(t) vs t. An error stating "Plotting failed. Replace complex numbers and NaNs by real numbers is showing. Kindly help me to resolve this issue.

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
ttokoro
20-Turquoise
(To:SU_10542991)

I am using Mathcad Prime 8. From Prime 7, Laplace and Fourier transforms are version upped. You can read PDF of my file. 

Anyway, h(t) is almost impulse, and the response is as same as input signal. Using convolution technique by * in Mathcad, the signal delay is about 3 microseconds. 

Tokoro.

 

View solution in original post

31 REPLIES 31
Werner_E
25-Diamond I
(To:SU_10542991)

As you can see the result of invlaplace contains limit operators (n->infinity). These limits can only be evaluated symbolically but a plot requires numeric evaluations. So the plot must fail.

Try yourself and type V.o(0.3)= and Prime will fail with an appropriate error message.

After all this means that Primes symbolic is not capable enough to find a decent representation of the inverselaplace transfomed. The result Primes symbolics returns is useless, it can't neither be evaluated symbolically nor numerically.

SU_10542991
4-Participant
(To:Werner_E)

Thank you for the response. I have checked Vo(0.3) and it is showing error. I understood that the limit operator (n-->infinity) is the issue. Is there any way to resolve this issue?

Werner_E
25-Diamond I
(To:SU_10542991)


@SU_10542991 wrote:
Thank you for the response. I have checked Vo(0.3) and it is showing error. I understood that the limit operator (n-->infinity) is the issue. Is there any way to resolve this issue?


Actually the limit operator is also not helpful if you try to symbolically evaluate Vo(0.3) as the result of Primes symbolic is just kind of a building plan how to derive the invlaplace transformed if, yes if we could simplify that derivation limit.
It just means that Prime is not capable enough to give you the answer you are asking for.

I tried with the legacy symbolic engine which is available up to Prime 6 and it wasn't able to come up with a solution function either

(but it shows that a bit more clearly that its not capable enough):

Werner_E_0-1672742260304.png

So at the moment I see no way to derive the output voltage using invlaplace with Prime.

SU_10542991
4-Participant
(To:Werner_E)

Thank you. I understood. I am using Mathcad Prime 7, so is this legacy symbolic engine available? I am not able to find it.

Werner_E
25-Diamond I
(To:SU_10542991)

No, the legacy symbolic engine (muPad) was the engine in real Mathcad 14 and 15 and also in Prime 1 - 6.

Prime 6 was the first version which included the new engine (where PTC doesn't have to pay license fees and also has more control over its development) and Prime 6 also was the only version where you were able to switch between the two engines. Starting with Prime 7 the new engine is the only one available.

But as I said - the old engine wasn't able to find a function, too.

In real Mathad 11 the symbolic engine was a stripped down version of Maple and this was the best symbolic engine implemented in Mathcad ever. Not sure if @LucMeekes  would be willing to give it try as he is still using this version of Mathcad.

Cornel
19-Tanzanite
(To:Werner_E)

@SU_10542991 
If it can help something or if further others colleagues come with other ideas starting from here::

CornelBejan_0-1672749347083.png

CornelBejan_1-1672749382862.png

CornelBejan_2-1672749458550.png

CornelBejan_3-1672749484433.png

 

Mathcad Prime 7 file attached.

 

 

Werner_E
25-Diamond I
(To:Cornel)

Hmmm, the argument for sinh in your V.o2 is so large that for every value of t (other than t=0) we have an overflow (value greater than 10^308). Thats the reason the plot consists of just one point at the origin.

I am not sure if linearizing the exponential functions give a meaningful result, but adding a "simplify" will at least make the whole thing plot:

Werner_E_3-1672761935009.png

Werner_E_4-1672761960935.png

 

Cornel
19-Tanzanite
(To:Werner_E)

CornelBejan_2-1672816416851.png

CornelBejan_16-1672816686746.png

CornelBejan_5-1672816472358.png

CornelBejan_8-1672816510635.pngCornelBejan_0-1672816350476.png

 

CornelBejan_9-1672816546930.png

CornelBejan_15-1672816657793.png

CornelBejan_12-1672816604936.png

CornelBejan_14-1672816634866.png

CornelBejan_1-1672816379852.png

 

If we use series, 4 approximation (which seems to be a good approximation for e^-0.1*s and e^-0.2*s) then te result is:

CornelBejan_17-1672816750687.png

@LucMeekes 

CornelBejan_18-1672817349637.png

CornelBejan_19-1672817390940.png

CornelBejan_20-1672817582889.png

 

CornelBejan_22-1672817712712.png

CornelBejan_23-1672817730740.png

CornelBejan_24-1672817800696.png

CornelBejan_25-1672817817749.png

 

Mathcad Prime 7 file attached.

SU_10542991
4-Participant
(To:Werner_E)

Thank you for the response @Werner_E .I discussed above, the issue I faced while plotting the Vi(s). Do you have any suggestion on this issue?

SU_10542991
4-Participant
(To:Cornel)

Thank you for the response @Cornel. I tried using your methodology and it is working, the only issue was that as @Werner_E said in the below response that 10^308 error was showing. So, I used the simplify symbolic also, and then it is working. The same methodology I tried to take the inverse laplace transform of Vi(s), but the following is the error showing up: I don't understand why is this "s" term coming in the inverse laplace transform term. What does this delta(t) mean?

SU_10542991_1-1672820239234.png

 

Werner_E
25-Diamond I
(To:SU_10542991)

Looks to me like the two "s" in the result of Vi2(s) are not labelled the same (a common bug in Prime).

Can't be told just from the pic, though.

Cornel
19-Tanzanite
(To:SU_10542991)

As @Werner_E wrote, it's probably about the fact that you don't have the same label for every s in your laplace equation. Some of the s in your equation have the label "Automatic", while others are likely labeled "Variable".  But you must have the same label for all s of your equation (whichever label you want, you choose the label you want to use) to receive a correct answer. Always put a worksheet of Mathcad.

CornelBejan_0-1672903558007.png

 

And I think the most likely correct answer to your problem is that in which you use series, 4 approximation because series, 4 approximation well approximates those exponential function, instead of series, 2 approximation.

@Werner_E  @LucMeekes  @ttokoro 
I think the problem with the fact that Vi(t) is not displayed, meaning that error occurs: "This variable is undefined. Check that the label is set correctly", is I think because we have to define that delta(t). How can we define this delta(t)? 

CornelBejan_1-1672903940804.png

CornelBejan_2-1672903973546.png


Mathcad Prime 7 file attached.

 

Werner_E
25-Diamond I
(To:Cornel)

The Dirac unit impulse Delta(t) is a symbolic only function.

You may write approximating function (very narrow spike with area underneath=1). but I don't think that this would solve the problem here satisfactory.

https://support.ptc.com/help/mathcad/r8.0/en/#page/PTC_Mathcad_Help/diracdelta_functions.html

Cornel
19-Tanzanite
(To:Werner_E)

I see the situation in principle like this: we should made a function by which we can use this delta(t) even numerically (not only symbolically), and then see what result gives Vi(t). But someone has to create this function through which we can use delta(t) even numerically...Maybe @ttokoro  knows (idk), I do not know how to create this delta(t) in such a way so that I can use delta(t) numerically, in calculations.

Werner_E
25-Diamond I
(To:Cornel)

You may try the approximation given here and in the follow up posts and see, you arrive at a meaningful result here.

https://community.ptc.com/t5/Mathcad/How-to-solve-a-RC-circuit-including-piecewise-and-periodic/m-p/331828/highlight/true#M129735

 

Cornel
19-Tanzanite
(To:Werner_E)

Thank you.

@Werner_E  @ttokoro  @LucMeekes @SU_10542991 

CornelBejan_15-1672922097751.png


Case 1: Using series, 2 approximation: 

CornelBejan_5-1672920878263.png

CornelBejan_18-1672922755237.png

CornelBejan_19-1672922820857.png

 

Case 2: Using series, 3 approximation: 

CornelBejan_6-1672921498689.png

This is because of: 

CornelBejan_7-1672921568921.png

CornelBejan_8-1672921604248.png

CornelBejan_9-1672921637315.png

 

Case 2: Using series, 4 approximation: 

CornelBejan_11-1672921956408.png

 

This is because of:

CornelBejan_10-1672921945221.png

CornelBejan_13-1672922015951.png

CornelBejan_14-1672922039082.png

And in the output we also can see:

CornelBejan_16-1672922252531.png

CornelBejan_17-1672922286223.png

 

So, Vi(s), Vi(t) is an unstable input as it is.

Only if we approximate those e^-0.1*s and e^-0.2*s with series, 2 approximation (so, with a linear expression) - series, 3 and series, 4 approximation are nonlinear expression - then Vi(s), Vi(t) and Vo2(s), Vo2(t) become a stable input and stable output.

Mathcad Prime 7 file attached.

SU_10542991
4-Participant
(To:Cornel)

Hi @Cornel regarding label, it is automatic. I am not able to choose a label as you said.

LucMeekes
23-Emerald III
(To:SU_10542991)

What is your Vi(t) ?

 

Have you tried transforming your input signal (Vi) alone to time domain?

 

Success!

Luc

SU_10542991
4-Participant
(To:LucMeekes)

Hi @LucMeekes 

 

I tried transforming the input signal Vi(s) alone to Vi(t). But it is showing error in plotting. I don't understand why while taking inverse laplace transform, "s" term is coming. And what does this delta(t) mean? Can you please correct me where I am wrong?

 

SU_10542991_0-1672819323548.png

 

LucMeekes
23-Emerald III
(To:SU_10542991)

I guess essentially I was asking: How did you come to the expression for the Laplace transform of your input signal?

Since it is not common to have/know only the Laplace transform. All in all this is assuming you're dealing with a real-world problem, and not some pure theoretic set-up.

The reason I'm asking is because that Vi(s) contains expression parts that are quite uncommon for the Laplace domain: the (1-exp(-a*s)) occur in signals with a step and staircase shapes.

Seems like your input signal is the double convolution of a box and a staircase.

 

Success!
Luc

 

Cornel
19-Tanzanite
(To:LucMeekes)

For example, we can see that in the case of series, 2 approximation, in Vo2(t) we receive a term that has staircase shape.

CornelBejan_0-1672933714906.png

CornelBejan_1-1672933739622.png

CornelBejan_2-1672933767402.png

 

 

 

SU_10542991
4-Participant
(To:LucMeekes)

Hi @LucMeekes The input is a DC shifted triangular wave.

ttokoro
20-Turquoise
(To:SU_10542991)

Maybe input signal is infinity number of triangle waves shown in green plot but that only shows 5 waves.
But cannot get Vout(t).

image.pngimage.pngimage.pngimage.png

SU_10542991
4-Participant
(To:ttokoro)

Hi @ttokoro this is right. The input signal is a triangular wave. May I kindly know why you are saying that Vout will not be obtained.

ttokoro
20-Turquoise
(To:SU_10542991)

The Laplace transform of a repetitive waveform with a period of T is
image.png
where, V1 (s) is the Laplace transform of a one-period waveform.
Unfortunately, it cannot inverse transform to t domain waveform. Therefore, we must use finite number of Laplace transform of voltage waveform.
image.pngimage.png
Left plot shows the transient current response of RL Circuit. (R=1, L=1) 
Right plot shows RCRC circuit response of all is unit value.
image.pngimage.png
In this case Mathcad can solve the answer. (In these plots, I use Maple2022 because it is faster than Mathcad.)
But using your R and C values, it shows nothing because C and R are so small and immediately charged to the applied voltage.
I think the time constant is so small and numerical calculation is failed.
 
SU_10542991
4-Participant
(To:ttokoro)

Hi

I am trying to plot the laplace transform Vi(s). I have derived this laplace transform of dc shifted triangular, which I suppose on take the inverse laplace transform and plotting should get a triangle waveform itself. But I am not getting it.

 

Also, in the previous response you have plotted vi(t). Here, I can see that you are not taking the "invlaplace" symbolic in mathcad and is defining vi(t). May I kindly know why you are doing like that?

 

I tried plotting the vi(t) equation as shown below but unable to plot v(2,t) like you did. Can you correct me? I want a triangular waveform ranging from 0.5V to 2.5V.

 

ttokoro
20-Turquoise
(To:SU_10542991)

image.pngimage.pngimage.pngimage.png

Output voltage of the system.
After about 3 microsecond, output signal is as same as input voltage of infinity triangle train.
Prime 8 sheet attached.

SU_10542991
4-Participant
(To:ttokoro)

Hi @ttokoro Thank you for the response. I am unable to open this .mcdx file that you shared. It is saying that the file is not compatible with the current version. I am using Mathcad prime 7. I observed that the answers that you are getting by taking the invplaplce is not obtained when I am trying to do. This is what I am getting:

 

SU_10542991_0-1673499939239.png

SU_10542991_1-1673500032666.png

Is this difference because you are using a different version mathcad?

 

 

ttokoro
20-Turquoise
(To:SU_10542991)

I am using Mathcad Prime 8. From Prime 7, Laplace and Fourier transforms are version upped. You can read PDF of my file. 

Anyway, h(t) is almost impulse, and the response is as same as input signal. Using convolution technique by * in Mathcad, the signal delay is about 3 microseconds. 

Tokoro.

 

Announcements

Top Tags