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

4-Participant

## recall function value of piecewise function

Hello,

i would like to plot the inductance current in mathcad. Piecewise functions describe the problem.

The piecewise function starts from the value before. How can I do it? Piecewise function with if/else are easy, but how can i save the function value.

Thank you for your help.

4 REPLIES 4
23-Emerald III
(To:bhg1993)
Please attach your Mathcad worksheet with a clear demonstration of your problem.
4-Participant
(To:LucMeekes)

Hello,

thanks for your help.

I hope you understand my problem with the pdf picture from before.

I attached the relevant part of my mathcad code to this message.

23-Emerald III
(To:bhg1993)

That did not explain your problem much clearer... The programming block returns a range of three values. What did you expect it to return?

Note that the result of a programming block is the evaluation of the last statement.

So your full block ONLY returns the result of time.i, which is the value of the very last element of the array time.

Attached is an example of a piecewise function. Hope it helps to clarify the usage. Don't hesitate to come back when you can explain your problem clearer.

Success!
Luc

24-Ruby V
(To:bhg1993)

Some remarks:

1) If you are working with units (and this is what you should do in Mathcad) its not a good idea to redifine m (the range 0..2) as you are loosing the unit meter that way

2) This range m is also the reason in your sheet why you can't assign your program a variable or function. You should not use a range here. Note that a range is not a vector!

3) You are using L in your various functions Delta_I_off. Are you aware that L means Liter = 10^-3 m^3 ? Thats the reason you are getting strange units in your results, I guess.

4) you don't need to initialize "zeit" in your program as its assigned a value anyway, but you sure should initialize "time[0" which you are using when i=1.

5) I suspect there also is something wrong with the way you derive the values in your function. Maybe its the use of the mod command or something else.

In the attached file I show, without fixing any of the above possible errors how you could create the three vectors where each value depends on the previous value and plot them over an appropriate time vector.

Hope it can be of help.

Announcements
Top Tags