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

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

How to preserve meshgrid compatibility after rotation

Asked by AP on 28 Oct 2012

Dear All,

I have generated a vector field in 3D. the coordinates are created by meshgrid. Now I need to rotate the domain 90° about y-axis. When I do this and try to plot the isosurface of some values, I get the following error:

Input grid is not a valid MESHGRID. 

How can I solve this problem?

Thanks,

Ahmad

3 Comments

Image Analyst on 28 Oct 2012

By using the debugger?

AP on 29 Oct 2012

This is the error message that I get in Matlab.

Matt J on 29 Oct 2012

How are you performing the rotation? A 90 degree rotation about y should transform (x,y,z) to (z,y,-x). Are you doing this formula directly, or are you using trigonometric functions to generate rotation matrices? If you are using trig functions are you using COS & SIN or are you using COSD & SIND ?

AP

Products

No products are associated with this question.

1 Answer

Answer by Matt J on 29 Oct 2012

You can't perform a coordinate transformation on a meshgrid and still expect it to be a meshgrid. Only certain transforms like translations preserve a mesh. Use griddata or TriScatterdInterp to obtain gridded samples.

3 Comments

Walter Roberson on 29 Oct 2012

90 degree rotations around the z axis would also preserve the grid structure.

Matt J on 29 Oct 2012

It would still form a lattice, but the new x-coordinates would not be monotonically increasing.

Walter Roberson on 29 Oct 2012

isosurface() requires that the X and Y be monotonic, not that they be monotonic increasing.

Matt J

Contact us