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

Mathcad 15 3D scatter plot from array of data

SOLVED
Rafal
Newbie

Mathcad 15 3D scatter plot from array of data

Hi all,

I am new to the forum, so I want to apologize If I did something wrong in posting the question in a wrong place.

I have an issue in creating a scatter plot in Mathcad 15 with an array of data. I get an error message: "This value must be an integer" in the "CreateSpace".

Can you please have a look at my Mathcad worksheet and see what am I doing wrong?

Thank you in advance for your help.

Rafal

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Mathcad 15 3D scatter plot from array of data

You created functions XX(j) etc. to be ble to use CreateSpace. But these functions are only valid for integer arguments in the range of 0 to rows(Solution)-1. The 3D-plot would try to evaluate these functions with non-integers arguments, too and so the error is thrown.

You could solve this problem by creating the functions using one of the interpolation functions Mathcad offers, but this would not be necessary.

All CreateSpace does is creating three vectors for the x-, y- and z-coordinates of the points to plot and nest them in a single vector.

You already have those xyz-vectors, so all you have to do is collect them in a vector and plot.

You may also be interested in

http://communities.ptc.com/docs/DOC-1155

http://communities.ptc.com/videos/1109

Lorenz.png

View solution in original post

3 REPLIES 3

Re: Mathcad 15 3D scatter plot from array of data

You created functions XX(j) etc. to be ble to use CreateSpace. But these functions are only valid for integer arguments in the range of 0 to rows(Solution)-1. The 3D-plot would try to evaluate these functions with non-integers arguments, too and so the error is thrown.

You could solve this problem by creating the functions using one of the interpolation functions Mathcad offers, but this would not be necessary.

All CreateSpace does is creating three vectors for the x-, y- and z-coordinates of the points to plot and nest them in a single vector.

You already have those xyz-vectors, so all you have to do is collect them in a vector and plot.

You may also be interested in

http://communities.ptc.com/docs/DOC-1155

http://communities.ptc.com/videos/1109

Lorenz.png

View solution in original post

Re: Mathcad 15 3D scatter plot from array of data

Thank you for your help in solving this issue Werner. Indeed, the solution works. I found it strange that the error appeared in this form, but your explanation that the 3D plot tried to evaluate those functions with non-integers arguments makes sense.

Best regards

Rafal

Re: Mathcad 15 3D scatter plot from array of data

You can right click the red character(s) the error is shown at and chose Trace Error - in your case this will bring you to the vector index j in XX[j.

You called CreateSpace with parameters 0, 100.

This would mean that j would run just from 0 to 100 (rather than the full length to 10^5). Furthermore you omitted the last grid parameter, which means that Createspace uses the default value 20. So it tries to create a vector with 20 elements. The first j-value would be 0, but the next is 100/19, a non-integer, throwing the error.

You could have uses CreateSpace(curve,0,100,21) without getting the error, but the plot would consist of 21 points only.

You get the full plot with CreateSpace(curve,0,100000,100001), but I think it does not make much sense, turning vectors into functions just to use CreateSpace to make vectors again 😉

Announcements