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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Translate the entire conversation x

3D surface plot of function of 2 variables

glardner
1-Visitor

3D surface plot of function of 2 variables

I am trying to plot as a 3D surface a function of two independent variables, but I am struggling to get it to work as I want.

The function calculates power availability (kW) as a function of steam pressure (40-80 bar) and steam temperature (400-500�C).

The function is expressed in the form W(P,T). If I put W in the placeholder on the surface plot, it gives the error message "parameters are out of range". But I do not know how to give units (kW, bar, �C) to the axes. If I enter W(P,T), the error becomes "This value must be an array"

How do I plot this type of function?

Gerard Lardner
19 REPLIES 19

"How do I plot this type of function ? "
______________________________

Attach your work sheet "Save as" version 11 or lower.

jmG

I hadn't attached the file before as it makes use of the WaterSteamPro library. However, since you have asked, here it is.

The basic function is that HP steam passes through a turbine, with MP extraction at about 17 bar and LP exhaust at around 10 bar - lower, if we can persuade our client to modify some other old plant; we would like the LP pressure to be 6 bar or less.

Process heaters for driers heat air in two stages, first using LP steam and then boosting the temperature using the MP steam to achieve a final air temperature of 190�C in one drier and 194�C in the other. Our aim has been to minimise the use of MP steam; an earlier version of this worksheet showed the effect of varying the LP pressure while using constant MP and HP pressures.

Thanks in advance for any assistance you can give.

Regards,

Gerard Lardner

On 5/6/2010 11:58:15 AM, Gerard_Lardner wrote:
>I hadn't attached the file
>before as it makes use of the
>WaterSteamPro library.
...
>Gerard Lardner
______________________________

This software is proprietary and not included in the work sheet. Your best bet is Valery. However it seems you want to plot the surface of either a square matrix or a rectangular matrix, which in other words means "interpolate", no problem. Attach the data table you want to plot.

jmG



I'll try to post the table when I'm back in the office tomorrow.

Part of the problem I see there is that Mathcad creates a single-column table from what is essentially a 2D data field; for each pressure value it computes the function for all temperature increments, then increments pressure and repeats. I don't see any way to redisplay the table as a rectangular table or array or matrix, so I guess I'll have to write a bit of code manually to rearrange it into a regular table.

Thanks for the suggestions.

Gerard Lardner

You are talking about �C and bar about steam properties. What is the dependent variable: heat contain ... etc ? Does no matter what is the dependent but as soon as you will have that 3rd column, you will have a scatter surface plot. The other alternative is to get that particular steam property directly from the IAPWS-97 steam tables. Or any similar steam table like Wukalowitch [1958].

jmG

>>Part of the problem I see there is that Mathcad creates a single-column table from what is essentially a 2D data field; for each pressure value it computes the function for all temperature increments, then increments pressure and repeats.<<

That would be a matter of how you set up the iterations over temperature and pressure. Using nested for loops you should be able to create a matrix representation of the function.
__________________
� � � � Tom Gutman

On 5/6/2010 6:41:57 PM, glardner wrote:
>I'll try to post the table
>when I'm back in the office
>tomorrow.
>
>Part of the problem I see
>there is that Mathcad creates
>a single-column table from
>what is essentially a 2D data
>field; for each pressure value
>it computes the function for
>all temperature increments,
>then increments pressure and
>repeats. I don't see any way
>to redisplay the table as a
>rectangular table or array or
>matrix, so I guess I'll have
>to write a bit of code
>manually to rearrange it into
>a regular table.
>
>Thanks for the suggestions.
>
>Gerard Lardner
____________________________

Your work sheet is all red, an horrible mess with no working equation. Read that one attached and give the ranges of p, t and it should be no problem for any collab to get the matrix of interest and the surface plot. Make sure I have interpreted the region 2 correctly.

jmG



Gerard,

A typical surface plot of that part of region 2. At this point or any other of your project, it is easy to interpolate the matrix. This one 10 x 10 is square, but it can be rectangular as well depending upon the limits of the part of the region 2 you define. Just a quick demo. IAPWS-97 traceable.

That should guide you for us to help and conclude your project.

Was created Mathcad 8, still working Mathcad 11. Some gyzma got messed up. Not as high pro and as complete than Valery "Water Steam Pro" but meats any data from IAPWS-97, because it is IAPWS-97 !

jmG

You are correct. Without access to the WaterSteamPro library there is almost no part of my worksheet that will be calculated.

However, thanks for your interest up to now. I think Alvaro has pointed me at sufficient information in the form of detailed examples for me to resolve this.

Regards,

Gerard Lardner

On 5/7/2010 8:19:46 AM, Gerard_Lardner wrote:
>You are correct. Without
>access to the WaterSteamPro
>library there is almost no
>part of my worksheet that will
>be calculated.
>
>However, thanks for your
>interest up to now. I think
>Alvaro has pointed me at
>sufficient information in the
>form of detailed examples for
>me to resolve this.
>
>Regards,
>
>Gerard Lardner
_______________________________

Quite correct if you have the Water Stean Pro library.
Just go the way I have shown typical Createmesh.

jmG



You need to go into the plot properties, quickplot parameters, to set the ranges of the independent variables.
__________________
� � � � Tom Gutman

I did try that, but without success.

It might help if I knew in which order the parameters relate to the axes; also, what is the effect of units - i.e. do the ranges understand �C or bar, or must they follow the SI defaults (K and Pa, for example)?

Thanks,

Gerard Lardner

The quickplot parameters are in the order in which they are specified in the function. Units are not provided for. I usually have my functions scaled so that the parameters are dimensionless, but I believe that otherwhise they must be specified in base SI units.

You can also use createmesh on the function, and plot the resulting array set. I think units can be used with that.
__________________
� � � � Tom Gutman

Thanks for explaining that.

This is the first time I have tried plotting a function, rather than a matrix, onto a 3D plot. I'm still getting my head around it.

Gerard Lardner

Thanks for that. That looks very helpful. And I find the original Mathcad worksheet is installed in the samples folder, so I can study it in detail.

Gerard Lardner

Thanks indeed for that suggestion. After a very brief perusal of the examples in that file, especially the first of the "3D plots" examples, I was quickly able to display my worksheet as I wanted it to appear.

I think I was assuming the Quickplot function in Mathcad to be much cleverer than it really is for 3D plotting. Once I realised I had to set out the ranges explicitly, it was straightforward.

One final question: in the example page you pointed me to, at the foot of the first 3D plots page just before the first 3D plot, there is a function fM(z,unit). What is that construct called? I can see what it does, but I don't know what it's called in Mathcad.

Regards, and many thanks,

Gerard Lardner

On 5/8/2010 10:25:36 AM, glardner wrote:
...
>I think I was assuming the
>Quickplot function in Mathcad
>to be much cleverer than it
>really is for 3D plotting.
>Once I realised I had to set
>out the ranges explicitly, it
>was straightforward.
>
...
>Regards, and many thanks,
>
>Gerard Lardner
______________________________

The Mathcad QuickPlot works by default the 2D function f(x,y), plot f... on the default ranges x, y � 5 meshed 20. So, a 2D function that does not exist in that range, won't plot and if there is singularity at 0,0 it won't plot . The quickplot is just a quick display in book style that consumes little memory and is very quick. But it does lot more wisely, simple and quick. The quickplot will work the implicit f(x,y) in the scalar form and it will carry all possible and executable scalar maths that can be applied.

In real applied engineering maths, we need more. Like extracting data values that can either be X,Y planes and Z level values. At this point of a project there are several ways of switching from the "scalar maths" mode to discretized mode. The Mathcad "Createmesh" then enters into play. This function is one of the most powerful Mathcad built-in function, simply a two nested for loop. I have the modified version that carries a parameter that belongs to the f(x,y) and thus will spool to file and store the same function as you will modify the parameter (p).

The Mathcad built-in Createmesh is designed to carry an optional rotation parameter for external use. What that means here is that you can design the the 3D solid in all sorts of rotations, store the resulting matrix and plug that in a foreign machine tool. For you to appreciate the rotation(s), visit this forum in the range of less than two weeks, something like "3D rotate". The function in demo is the "Breather", one of the most [if not the most] demonstrative 3D plot that Mathcad renders as perfectly than any other math tool.

That's not all ! There is also the 3D slicer that rotates and extract the two slices in each direction ==> x, ==>y ... export and further process either or both slices [derivative, integrate]. In Mathcad there is limitation but the first limit is the user. Once in hand the matrix level, just plug it in the picture tool for more image processing ... for instance: your steam properties, you can have in a gray scale image. You can extract any pressure (p), temperature (�C) slice ... You can extract the overall matrix for tabulation, from which tabulation you will be able to replot the surface, spline square/rectangular.

All those things are nice and fine, but they don't speak much to the control room operator neither to the plant manager. Those guys sleep in a bed of $$$$$ heavily grounded to earth. They just want 3 meters and 3 columns of data : p, T and enthalpy [per say] and datalog for tracking the plant operation . You could even datalog the images of the hourly operation [per say], plot an RGB cross hair in the region of operation vs another reference cross hair ,,, thus tracking and tracing the life of the plant, no pain no sweat.

Get the 3D rotate, open this one attached.
It will give you a good insight of what Mathcad can do for you.

jmG





Thanks very much for that. I will study what you have written (and the Mathcad docs) and the demo. I have not had an understanding of 3D graphics in Mathcad before, but I do need it now.

Gerard Lardner
Announcements

Top Tags