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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Mathcad Plot with an if-statement?

ptc-6644390
1-Newbie

Mathcad Plot with an if-statement?

Hi,

First time posting on these forums, been reading around for a couple of years though.

I would like to create a plot of 4 functions (let's say it's different pressures depending on a variable, h). I've done this in the appended example.

However, I would now like to plot only 2 of the functions if a variable, say "condition", is =1.

How can I do this?

I have tried adding an "if" statement on the y-axis of the plot itself, like this:

----

f.1(h) if condition=1

----

, but I get a critical error when doing that, and the plot goes blank.

I'm using MathCad 15.

Any suggestions are appreciated,

Thank you,

Hampus

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:ptc-6644390)

NaN (non a number) is very useful when you want something to not show on a plot. It works for either entire plots, or individual points.

View solution in original post

8 REPLIES 8
RichardJ
19-Tanzanite
(To:ptc-6644390)

NaN (non a number) is very useful when you want something to not show on a plot. It works for either entire plots, or individual points.

Richard,

Thank you, that worked perfectly!

MikeArmstrong
5-Regular Member
(To:RichardJ)

Richard Jackson wrote:

NaN (non a number) is very useful when you want something to not show on a plot. It works for either entire plots, or individual points.

Nice trick that Richard

Mike Armstrong wrote:

Richard Jackson wrote:

NaN (non a number) is very useful when you want something to not show on a plot. It works for either entire plots, or individual points.

Nice trick that Richard

Yes!

Wish 3D plots could handle NaN's as well! (its a bit better in Prime but not sufficently)

RichardJ
19-Tanzanite
(To:Werner_E)

Wish 3D plots could handle NaN's as well! (its a bit better in Prime but not sufficently)

I wish that could be said about other capabilities of 3D plots in Prime

Richard Jackson wrote:

Wish 3D plots could handle NaN's as well! (its a bit better in Prime but not sufficently)

I wish that could be said about other capabilities of 3D plots in Prime

I must have missed something - Plots in Prime have capabilities?

Depeding on your needs it might be convenient to use a wrapper function based on Richards solution.

See attached.

Nifty! That's a keeper, thanks

Top Tags