Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Plot Nonorthogonal Coordinate Systems

Subject: Plot Nonorthogonal Coordinate Systems

From: Eric Belcastro

Date: 17 Dec, 2008 21:27:21

Message: 1 of 9

Hi, I am new to matlab, and have searched around for a good method of achieving this and haven't found it yet, so I thought I would ask for some help.

     I am working with a hexagonal coordinate system, defined in terms of the basis vectors - (in terms of polar coordinates (magnitude,angle)) - (1,0) and (1,pi/3). Technically the coordinates have a two-coordinate and a three-coordinate representation, but the three-coordinate representation I am not concerned with here. I have all of the basic mathematical understanding of the coordinate system that I need - but I don't understand how to represent and plot nonorthogonal coordinate systems in matlab. All that I really have to do is tilt the y-basic vector of the standard Cartesian model clockwise by 30 degrees, and have the coordinates be defined in terms of these basis vectors - that should be quite easy. Yet I don't see any standard routines for doing such a thing.

    My reasons for doing this are to investigate the properties of numbers on this grid via different reflections and rotations, and also to investigate a non-orthogonal representation of complex numbers. Just for fun in other words. ;) I am in between semesters and feel like getting out all of those ideas that I don't have time for when class is in session.

Thank you in advance for any help.
Eric Belcastro

Subject: Plot Nonorthogonal Coordinate Systems

From: Matt

Date: 17 Dec, 2008 22:10:18

Message: 2 of 9

Eric Belcastro <eric@telltree.com> wrote in message <23836964.1229549272245.JavaMail.jakarta@nitrogen.mathforum.org>...
> Hi, I am new to matlab, and have searched around for a good method of achieving this and haven't found it yet, so I thought I would ask for some help.
>
> I am working with a hexagonal coordinate system, defined in terms of the basis vectors - (in terms of polar coordinates (magnitude,angle)) - (1,0) and (1,pi/3). Technically the coordinates have a two-coordinate and a three-coordinate representation, but the three-coordinate representation I am not concerned with here. I have all of the basic mathematical understanding of the coordinate system that I need - but I don't understand how to represent and plot nonorthogonal coordinate systems in matlab. All that I really have to do is tilt the y-basic vector of the standard Cartesian model clockwise by 30 degrees, and have the coordinates be defined in terms of these basis vectors - that should be quite easy. Yet I don't see any standard routines for doing such a thing.
>
> My reasons for doing this are to investigate the properties of numbers on this grid via different reflections and rotations, and also to investigate a non-orthogonal representation of complex numbers. Just for fun in other words. ;) I am in between semesters and feel like getting out all of those ideas that I don't have time for when class is in session.
>
> Thank you in advance for any help.
> Eric Belcastro


Why couldn't you simply convert the data to Cartesian coordinates for the purpose of plotting?

Subject: Plot Nonorthogonal Coordinate Systems

From: Eric Belcastro

Date: 18 Dec, 2008 05:04:39

Message: 3 of 9

Matt: "Why couldn't you simply convert the data to Cartesian coordinates for the purpose of plotting?"

That is a very reasonable response - and the answer is that I can, and, in fact, the conversions are quite easy to make. The reason that this isn't acceptable to me is that the entire existence of the coordinate system is allow for certain relationships to arise out of the representation, such that coordinates on the grid are represented by integers, and there transformations and corresponding eutrigonometric (eutrigon - triangle with 60 degrees, eutrigonometry utilizes the ratios of the sides of a 60 degree triangle instead of a right triangle, yes I just made the word up) relationships become self-evident in such a coordinate system. When we are young we learn not to put triangle pegs in square holes. So I am looking for the triangle hole, the square hole will not suffice for my aims, it will only obscure, not clarify.

Subject: Plot Nonorthogonal Coordinate Systems

From: Jackie Larsen

Date: 18 Dec, 2008 13:50:20

Message: 4 of 9

Eric Belcastro <eric@telltree.com> wrote in message <24279765.1229576710076.JavaMail.jakarta@nitrogen.mathforum.org>...
> Matt: "Why couldn't you simply convert the data to Cartesian coordinates for the purpose of plotting?"
>
> That is a very reasonable response - and the answer is that I can, and, in fact, the conversions are quite easy to make. The reason that this isn't acceptable to me is that the entire existence of the coordinate system is allow for certain relationships to arise out of the representation, such that coordinates on the grid are represented by integers, and there transformations and corresponding eutrigonometric (eutrigon - triangle with 60 degrees, eutrigonometry utilizes the ratios of the sides of a 60 degree triangle instead of a right triangle, yes I just made the word up) relationships become self-evident in such a coordinate system. When we are young we learn not to put triangle pegs in square holes. So I am looking for the triangle hole, the square hole will not suffice for my aims, it will only obscure, not clarify.

Well since you only need the "convenrsion" of the coordinates when doing the plotting, the solutions is simple to write your own plot function, which takes your coordinates in the special basis, and converts them prior to plotting.

That way you keep your convention.

Subject: Plot Nonorthogonal Coordinate Systems

From: Eric Belcastro

Date: 18 Dec, 2008 23:25:45

Message: 5 of 9

Jackie:Well since you only need the "convenrsion" of the coordinates when doing the plotting, the solutions is simple to write your own plot function, which takes your coordinates in the special basis, and converts them prior to plotting.

Yes, most certainly - but what I need is a way to > visualize < the results of various computations within the triangular grid, thus I need the triangular tick mark grid that would be naturally created by a nonorthogonal coordinate system. Without that visual aid, the numbers, so natural on a triangular grid, are just a bunch of dots on a page in the cartesian system, regardless of the accuracy of their placement. without this visual aid, nothing has been achieved by the visual representation.

Subject: Plot Nonorthogonal Coordinate Systems

From: Johan Carlson

Date: 19 Dec, 2008 08:22:04

Message: 6 of 9

Eric Belcastro <eric@telltree.com> wrote in message <11912819.1229642775710.JavaMail.jakarta@nitrogen.mathforum.org>...
> Jackie:Well since you only need the "convenrsion" of the coordinates when doing the plotting, the solutions is simple to write your own plot function, which takes your coordinates in the special basis, and converts them prior to plotting.
>
> Yes, most certainly - but what I need is a way to > visualize < the results of various computations within the triangular grid, thus I need the triangular tick mark grid that would be naturally created by a nonorthogonal coordinate system. Without that visual aid, the numbers, so natural on a triangular grid, are just a bunch of dots on a page in the cartesian system, regardless of the accuracy of their placement. without this visual aid, nothing has been achieved by the visual representation.


So, you're saying that you need the complete axes with tick labels and maybe also a grid? Would you also like to be able to find the coordinates of the points (in the non-orthogonal system) for example by moving the mouse over the plot?

The only solution I see is to draw your own coordinate system and then turn off the old one. It's a bit of coding to do, but if you have the representation of the non-orthogonal axes in the cartesian system, it should be possible.

/JC

Subject: Plot Nonorthogonal Coordinate Systems

From: Lars Barring

Date: 19 Dec, 2008 09:28:03

Message: 7 of 9

Johan Carlson wrote in message <gifljc$noo$1@fred.mathworks.com>...

> The only solution I see is to draw your own coordinate system and then turn off the
> old one. It's a bit of coding to do, but if you have the representation of the
> non-orthogonal axes in the cartesian system, it should be possible.

Would this possibly be of help as a starting point:
http://www.mathworks.com/matlabcentral/fileexchange/2299

best,
Lars

Subject: Plot Nonorthogonal Coordinate Systems

From: Eric Belcastro

Date: 19 Dec, 2008 17:01:59

Message: 8 of 9

Johan Carlson:The only solution I see is to draw your own coordinate system and then turn off the old one. It's a bit of coding to do, but if you have the representation of the non-orthogonal axes in the cartesian system, it should be possible.

I see what you mean, and it's a good idea. It will be kind of annoying, but once I code it once, it will be there for me. I will dig in more to study some of the graphical abilities of matlab and see what I can do. The drawing of the coordinate system will be easy, but adding other features I have in mind will take a bit of time.

Thank you everyone for the recommendations and responses.

Subject: Plot Nonorthogonal Coordinate Systems

From: Eric Belcastro

Date: 19 Dec, 2008 17:03:21

Message: 9 of 9

Lars Barring:Would this possibly be of help as a starting point:
http://www.mathworks.com/matlabcentral/fileexchange/2299

Actually, it just may. I will have to modify it a bit, but it may provide a base to work off of. Thanks for pointing it out. :)

-Eric

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us