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

surface plot

payman
13-Aquamarine

surface plot

Hello,

Could you please help me with the attached graph? The surface graph shows much higher values for the parameter on z-axis.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:payman)

The problem is that you want to plot a surface but you don't have surface data!

All you have is a bunch of more than thousend points in 3D. You can plot those points chosing scatter plot and maybe connect the points in the order the points are in the vectors you provide. But you dont have a mesh structure which would enable mathcad to plot a surface through those points.

I don't know why Mathcad does not return an error message when you try to do a surface plot with simple point data but it doesn't. Instead it tries to create a surface by some sort of interpolation. i have no idea what it tries and how, but this seems to be the reason for the high z-values you noticed.

using a scatter plot will give you the correct z-values, but no surface.

Unfortunately Mathcad does not provide any 3D surface fitting or regression methods, so unless you are able to rearrange your data to form a mesh you will have to program that kind of routines on your own.

You also search this forum for buzzwords like "surface fit" - maybe someone had already posted a routine you could use.

Here is what the scatter plot of your data looks like:

1.png

View solution in original post

8 REPLIES 8
Werner_E
24-Ruby V
(To:payman)

The problem is that you want to plot a surface but you don't have surface data!

All you have is a bunch of more than thousend points in 3D. You can plot those points chosing scatter plot and maybe connect the points in the order the points are in the vectors you provide. But you dont have a mesh structure which would enable mathcad to plot a surface through those points.

I don't know why Mathcad does not return an error message when you try to do a surface plot with simple point data but it doesn't. Instead it tries to create a surface by some sort of interpolation. i have no idea what it tries and how, but this seems to be the reason for the high z-values you noticed.

using a scatter plot will give you the correct z-values, but no surface.

Unfortunately Mathcad does not provide any 3D surface fitting or regression methods, so unless you are able to rearrange your data to form a mesh you will have to program that kind of routines on your own.

You also search this forum for buzzwords like "surface fit" - maybe someone had already posted a routine you could use.

Here is what the scatter plot of your data looks like:

1.png

RichardJ
19-Tanzanite
(To:Werner_E)

I don't know why Mathcad does not return an error message when you try to do a surface plot with simple point data but it doesn't. Instead it tries to create a surface by some sort of interpolation.

Because you can plot a surface using x, y, and z vectors. As you say, it uses some form of interpolation, which does not always work so well even if the data is on an evenly spaced grid. The plot is more reliable if the x, y, z vectors are converted to X, Y, Z matrices.

Unfortunately Mathcad does not provide any 3D surface fitting or regression methods, so unless you are able to rearrange your data to form a mesh you will have to program that kind of routines on your own.

You also search this forum for buzzwords like "surface fit" - maybe someone had already posted a routine you could use.

Fitting a surface to 3D data is simple enough using minerr, but this data does not look like a surface that could be fitted with a function with any reasonable number of parameters.

Richard Jackson wrote:

I don't know why Mathcad does not return an error message when you try to do a surface plot with simple point data but it doesn't. Instead it tries to create a surface by some sort of interpolation.

Because you can plot a surface using x, y, and z vectors. As you say, it uses some form of interpolation, which does not always work so well even if the data is on an evenly spaced grid.

The few times I tried it never produced anything of use. I can't remember that I ever found any documentation describing what kind of interpolation Mathcad applies if asked to do a surface plot with three vectors.

The plot is more reliable if the x, y, z vectors are converted to X, Y, Z matrices.

This would only be possible if the data is on an evenly spaced grid (which is not the case here), right?

Fitting a surface to 3D data is simple enough using minerr, but this data does not look like a surface that could be fitted with a function with any reasonable number of parameters.

Correct, I had tried a polynomial of sixth order with 49 parameters and the result wasn't even close to useable.

Guess PTC could implement a few algorithms from Creo 😉

RichardJ
19-Tanzanite
(To:Werner_E)

The few times I tried it never produced anything of use. I can't remember that I ever found any documentation describing what kind of interpolation Mathcad applies if asked to do a surface plot with three vectors.

I don't think it works unless the data is on an evenly spaced grid. Even then, I've seen weird edge effects that don't exist if you convert the vectors to matrices. I have no idea how the interpolation is done. I think it's part of the OpenGL graphics, so documentation may be available, but not from Mathsoft / PTC.

This would only be possible if the data is on an evenly spaced grid (which is not the case here), right?

True.

Guess PTC could implement a few algorithms from Creo 😉

I think you are being overly optimistic there, given that PTC seems to have a lot of problems just implementing algorithms from older Mathcad in newer Mathcad

Guess PTC could implement a few algorithms from Creo 😉

I think you are being overly optimistic there, given that PTC seems to have a lot of problems just implementing algorithms from older Mathcad in newer Mathcad

Rest assured that my optimism concerning the development of Prime is rather subdued and curbed to say the least.

payman
13-Aquamarine
(To:Werner_E)

Thank you.

It is still not clear to me that why my data points are not suitable for surface plot. is it because the number of data points are not large enough ? or they need additional process?

RichardJ
19-Tanzanite
(To:payman)

They are not on an evenly spaced x-y grid. Mathcad cannot generate a mesh unless the points are on a regular grid.

Werner_E
24-Ruby V
(To:payman)

To create a surface Mathcad uses a mesh consisting of quadrilaterals. Every data point normally would be member of four quadrilaterals. You data simply misses the informations which points should form a quidrilateral or in other words, which points are neighbours.

Top Tags