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

Normalizing x,y axis of a Contour Plot

thiirane
4-Participant

Normalizing x,y axis of a Contour Plot

Hello Experts,

I have a request that hopefully is not difficult. I have a matrix One

When I plot One the x and y axis is defined by the indices of the Matrix One

I need the X and Y axis to be normalized from 0 to 1 and from -1 to 1

Can you help?

Thanks

Russ

10 REPLIES 10
thiirane
4-Participant
(To:thiirane)

One additional comment.... I need the Matrix "One(x,y)" to be Normalized such that "One(m,n) such that m and n range from 0 to 1 and -1 to 1.

if you want it to normalize, how do you want the point between [0,1] and [-1,1] looks like? is it a contiuous contour or you just want a discret point (1) in every corner and zero everywhere? Do you want it to change linearly? exponentially? or some other way? You need to be more specific.

thiirane
4-Participant
(To:ptc-4735478)

Hi Henry,

Thanks for helping...

Rather than having a Matrix whose x and y coordinates are defined by its indices, I need the Matrix to have x and y coordinates defined by the mapping from 0 to 1 and -1 to 1.

This is an exercise in the creation of a fractal. I need to have to spatial distribution to be mapped to -1 to 1 See the bottom of the attached.

Werner_E
25-Diamond I
(To:thiirane)

Would the two approches in the attached file help?

The first is to use with a 3D contour plot. As a mtrix can't have non integer indices I created a function f(Q,x,y) which uses the table as a lookup.

The second is for use in a normal 2D plot. A matrix is generated where the first colum represent the normalized x-, and the second the normalized y-values of all those elements in the original matrix with a value of 1.

Another approach would be to create a matrix which represents a bitmap, as was shown in this forum some times with different fractals. This approach would be extremely useful for colorful fractals like a mandelbrot, as you would have more control over color mapping, etc.

RichardJ
19-Tanzanite
(To:thiirane)

The 3D plot is using the row and column indices because you haven't given it any x and y values. You need to create a matrix of x values and a matrix of y values. Put the x, y, and z values in a nested matrix, and drop that into the plot. see the attached.

thiirane
4-Participant
(To:RichardJ)

Thank you Richard. That's is what I did not know how to do. Sure appreciate your help. Thank you also to the other contributors.

thiirane
4-Participant
(To:RichardJ)

Richard,

I have a follow-on question. I need to reference points in the transformed space. I see that when I "flatten" the nested arrays that you created in "QQQ" the results is complicated. I need to be able to specify for example QQQ(x,y) such that a plot of QQQ(0,0) yields a point in the center of the fractal. Does this make sense?

Q3Nflat.PNG

thiirane
4-Participant
(To:thiirane)

I have played with this a bit more. I was able to get a function that plot QP(x,y) but its a line not a point. Hmmm.

Werner_E
25-Diamond I
(To:thiirane)

Try the attached.

Plot2 is formatted as Scatterplot/DataPoints. That way you are able now to rotate, tilt, twist and zoom your plot using the mouse or the format menu, so be careful not to do so. Standard values are 0 for Rotate and 90 for Tilt and Twist.

PS: You may consider formatting Plot1 as scaterplot, too and play around with pointsize and colormap. See attached.

RichardJ
19-Tanzanite
(To:thiirane)

It's not as complicated as it looks at first glance.The first matrix is the x coordinates, so all the columns are identical. The second matrix is the y coordinates, so all the rows are identical. If you look at either matrix on it's own as a surface, it's an inclinded plane. That's why you get all those stripes when you plot it as a contour plot.

Announcements

Top Tags