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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

3D graph of element excitment in and array

GC1
1-Newbie
1-Newbie

3D graph of element excitment in and array

Hello

I am a new Mathcad user(ver 14) and I am trying to plot the energy level of each element in a 320 x 256 element array. The input file is in the form of x and y location and level for each element, essentially a 3 column matrix with 80,000+ rows.

I can't figure out how to create this plot. In my mind, I see it as an image in the XY plane with the element intensities varying in the z axis. Any help would be greatly appreciated.
Thanks
Greg
34 REPLIES 34
TomGutman
1-Newbie
(To:GC1)

Depends.

If the data are on a regular (quadrillateral) grid, form three matrices, each 320x256, containing the x, y, and z coordinates. Plot all three as a single plot.

Alternatively, form three separate vectors for the x, y, and z coordinates. This wll interpolate a surface (defined as z=f(x,y) and may not be as accurate as using three matrices. But it will work provided the x and y coordinates are sufficiently well spaced, even if not on a regular grid.
__________________
� � � � Tom Gutman
GC1
1-Newbie
1-Newbie
(To:TomGutman)

Thanks Tom

I must still be too inexperienced with the interface. I am importing my data file using the Data import wizard under insert component. I then name the matrix with a unique name and and set x, y, and z equal to one of the 3 columns, 0, 1, or 2.

I then insert a 3D surface plot and x,y, and z

and i get the attached plot

GC1
1-Newbie
1-Newbie
(To:GC1)

As you can see in the uploaded file, the x vlues are all glumped together, as are the y and z values. How can i define the x, y, and z values as coordniates for a single point?

Thanks
Greg
RichardJ
19-Tanzanite
(To:GC1)

Ah. A common mistake. You need to group the coordinates in parentheses. So

x,y,x

is seen as three separate plots, whereas

(x,y,z)

is seen as one plot with three coordinates. If you had

(x1,y1,z1),(x2,y2,z2)

that would be two plots, each with three coordinates.

Richard
GC1
1-Newbie
1-Newbie
(To:RichardJ)

Thank you Richard!
GC1
1-Newbie
1-Newbie
(To:GC1)

Now that i have my matrices defined and can get a 3D plot of the array's excitement level, I need to be able to verify small areas of pixels within the matrix and i can't figure out how to do it. Perhaps I'm not using the correct terms in the search, but my attempts so far have not been fruitful. The following is an example of what i would like to do:

Suppose there is a 3 column matrix where column 1 is x value, column 2 is y value and column z is some intensity value at the x,y coordinate. How would I address say each row of x to get the corresponding z value.
Fred_Kohlhepp
23-Emerald I
(To:GC1)

You can use the match function to determine the index of a particular value in a vector. If you need to interpolate between the values actually in the vector, then you'll need to define z as functions of x and y; see curve fitting in help.


Fred Kohlhepp
fkohlhepp@sikorsky.com

On 11/4/2009 10:26:01 AM, fkohlhepp wrote:
>You can use the match function
>to determine the index of a
>particular value in a vector.

One also needs to be able to deal with multiple values of x - a possibility if x and y are grid co-ordinates.

Stuart

>Now that I have my matrices defined and can get a 3D plot of the array's ...<<br> ==> Now that you have an array, either square/rectangular
==> you can inspect for pixel but you can't as you say because of

>Suppose there is a 3 column matrix where column 1 is x value, column 2 is y value and column z ...<<br>
==> because you don't have an array of level but just 3 scatter vectors that you must explode to an array.
==> if you have a 2d function, please attach "Save as" version 11,
it will be a minute job for the returned sheet, but I will be away for few hours.

I will look back in the thread if the work sheet is there.
Maybe you already have two answers ?

jmG


>and i get the attached plot<<br> _____________________________

... that does NOT make much sense !

Just create an input table in a blank Mathcad sheet,
"Save as" 11, attach in your next visit.

jmG

As you pointed out, perhaps I don't have my array's defined properly. The x and y columns are indeed grid coordinates for each element in my sensor so I would want the capability to look intensity as a function of x-y location either as individual elements or as rows or columns i will see what i can figure out in this regard.

Thanks
Greg
StuartBruff
23-Emerald II
(To:GC1)

On 11/4/2009 12:29:14 PM, GC1 wrote:
== As you pointed out, perhaps I don't have my array's defined properly. The x and y columns are indeed grid coordinates for each element in my sensor so I would want the capability to look intensity as a function of x-y location either as individual elements or as rows or columns i will see what i can figure out in this regard.

Is the function wrapdata in the attached worksheet any help?

Stuart

(note that I have corrected an error that was present in the previous worksheet - I had yy set to repcol(x instead of repcol(y ; this showed up when I made the x and y values differ)
TomGutman
1-Newbie
(To:GC1)

It would help if you were to post the actual data.

If you have x and y as coordinates on a rectangular grid you should be using matrices, not vectors. For access purposes you want x and y to be vectors, identifying the coordinates for rows and columns in the z (intensity matrix). For plotting purposes x and y need to be expanded to matrices, matrices which are constant along the rows or columns.

If you need interpolation (or just want easy access using x and y values) you can use a cubic spline interpolation. If your array is square (same number of x and y coordinates) you can just use cspline directly. If the number of coordinates differ, you can use the routines from my cubic splines sheet to do the spline.
__________________
� � � � Tom Gutman

>As you pointed out, perhaps I don't have my array's defined properly<<br> _________________________

Please, do nothing, attach the data as they are collected, as they are collected from the lab, in their original format. Many collab can open them if not possible directly in Mathcad. It looks already scrapped. If you have 3 scatter vectors from the lab (which I doubt), no problem. If you have 3 badly collected data vectors, collected from no principle of future use, that is another problem. It may just be a case of bivariate.

jmG

Sorry for the late response, I've been away for a few days. Here is some representative data:
GC1
1-Newbie
1-Newbie
(To:GC1)

For proprietary reasons, i could not upload actual data. The file is representative of what I am working with.

The wrap data example may be what i need. I will study it further.

I really do appreiciate all of the help with this problem.

Thanks again
Greg

On 11/10/2009 2:10:38 PM, GC1 wrote:
>For proprietary reasons, i
>could not upload actual data.
>The file is representative of
>what I am working with.
>
>The wrap data example may be
>what i need. I will study it
>further.
>
>I really do appreciate all of
>the help with this problem.
>
>Thanks again
>Greg
_______________________________

What are you looking after ?

Your data set is incorrectly collected.



jmG

... extract the portion of the data you want to analyse.

jmG

...in Mathcad 11.2a:

1. the surface plot does crash Mathcad
2. the patch plot meshed 99, 99 does crash Mathcad
3. the extracted data is scaled 0...255.

jmG

... two more help hints:

1. you don't have a matrix, therefore can't have the picture tool.
For that you need the exploder [available]
2. You can fake colors once the matrix will be exploded.

jmG

...

1. exploder added, typical "exploded"
2. now can have picture tool.

jmG

On 11/10/2009 5:19:15 PM, jmG wrote:
== ...in Mathcad 11.2a:
== 1. the surface plot does crash Mathcad
== . the patch plot meshed 99, 99 does crash Mathcad
== 3. the extracted data is scaled 0...255.

It doesn't seem to do it in my M11.2a - once I'd replaced the FileRead component with a READPRN statement.

Stuart

>It doesn't seem to do it in my M11.2a<<br> ______________________________________

I have not checked this last version. No more a 3D surface plot, just an image ready for processing as it looks obvious to me the vectors are pixel values as collected. As soon as the visitor will acknowledge this attachment, I will zap all my other ones. Not too good an idea to have appended two different data sets. I filled in a missing row.



jmG
StuartBruff
23-Emerald II
(To:GC1)

On 11/10/2009 2:05:29 PM, GC1 wrote:
>Sorry for the late response,
>I've been away for a few days.
>Here is some representative
>data:

Attached is modified version of the previous worksheet I posted.

Change the source of the data to your local copy of the test data.

Stuart


TomGutman
1-Newbie
(To:GC1)

Usually it's quite straightforward to reshape this sort of data to plot it. But you are missing the data point at (0,255). With that sort of irregularity you need the more convoluted methods as done by Stuart. Or you can restore the missing datum -- how did it get to be missing in the first place?
__________________
� � � � Tom Gutman

On 9/24/2009 3:19:37 PM, GC1 wrote:
>Hello
>
>I am a new Mathcad user(ver
>14) and I am trying to plot
>the energy level of each
>element in a 320 x 256 element
>array. ...
>Greg
_______________________________

For that part of your project: "Scatter Unk.mcd"

Read +:

>Plot all three as a single plot.< [Tom Gutman]
==> The image requires the matrix of levels [jmG]
>I then name the matrix with a unique name and and set x, y, and z equal to one of the 3 columns, 0, 1, or 2< [GC1]
==> The xy planes are inverted [jmG]
>How can i define the x, y, and z values as coordinates for a single point ? <<br> ==> Use my exploder [jmG]
>A common mistake< [Richard]
==> YES following my guidance, solves the mistake. [jmG]
>I need to be able to verify small areas of pixels within the matrix and i can't figure out how to do it< [GC1]
==> Plenty of work done in this collab, using the picture tool. [jmG]
>...see curve fitting in help.< [Fred]
==> That will destroy any and plenty of applicable image processing. [jmG]
>The x and y columns are indeed grid coordinates ...< [GC1]
==> INDEED they are, but not needed past the "exploder". [jmG]
>If the number of coordinates differ, you can use the routines from my cubic splines sheet to do the spline. [Tom Gutman]
==> Rather use Valery rectangular spline. [jmG]

>The wrap data example may be what i need< [GC1]
==> What is "wrap data", what do you mean by that ? [jmG]

Conclusion:
You are ready to go ahead from my last attachment "Scatter Unk.mcd"
i.e: pursue image processing ... etc. Plenty of effective help,
if so you need + : please specify clearly.

RemToRem:
Not all scatter collection can be exploded as easily as yours, because not all xy planes are colinear.
Mathcad is purely Cartesian XYZ, not as you have YXZ.

jmG

>>Rather use Valery rectangular spline. [jmG]<<

I disagree. That is a very inefficient implementation, that solves for many spline parameters for each calculated data points. My routine works like the normal cspline, precalculating all the parameters first and then evaluating each datum based on that calculation.
__________________
� � � � Tom Gutman

On 11/10/2009 10:16:48 PM, Tom_Gutman wrote:
>>>Rather use Valery rectangular spline. [jmG]<<
>
>I disagree.
> ...
>� � Tom Gutman
_______________

Demonstrate/illustrate.

jmG



It's all in my cubic splines work sheet.
__________________
� � � � Tom Gutman
Top Tags