plotting data in an non orthogonal coordinate system

17 views (last 30 days)

Hi,

I stored different values in a matrix, values calculated with a formula f based on non otrhogal axis. The values represent forces in geometric surface in a non orthoganal coordinate system.

My question: How to plot the values on the surface in an non orthogonal coordinate system?

Thanks in advance!

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 7 Feb 2013
Edited: Azzi Abdelmalek on 7 Feb 2013
3D plot
close
k=10
x=0:0.1:10
y=sin(x)
z=10*x.*y
plot3(x,y,z)
%----------New coordinate system------------------
b=sqrt(3)/2;
a=1/2;
hold on
plot3([0 a],[0 b],[0 0],'g') % new axis
plot3(xlim ,[0 0],[0 0],'g')
%----------New x,y and z in the new coordinate system---
new_x=y*a+x;
new_y=y*b;
hold on,
plot3(new_x,new_y,z,'r')
grid

More Answers (4)

Azzi Abdelmalek
Azzi Abdelmalek on 7 Feb 2013
Edited: Azzi Abdelmalek on 7 Feb 2013
close
x=0:0.1:10
y=sin(x)
plot(x,y)
% If you want to plot in the the new coordinate system newvector_j=a+b*j,
% we suppose the unit vector i is the same
a=1;
b=2;
hold on
plot([0 a],[0 b],'g') % new axis
plot(xlim ,[0 0],'g')
new_x=y*a+x
new_y=y*b
hold on,plot(new_x,new_y,'r')

Dirk
Dirk on 7 Feb 2013
Edited: Dirk on 20 Feb 2013
Hi, Thanks for your comment! It works for a 2D plot.
But now i'm struggling with the 3D problem. In the following code, a surface is plotted. On the surface, a shearforce, calculated with the function 'tau' is plotted on the surface in an orthogonal coordinate system. But when defining a new value for 'omega' (the angle between the x and y axis), i.e. 70° the surface with the shearforce onto should be plotted in a non orthogonal coordinate system, with an angle of 70° between the x and y value.
  2 Comments
Dirk
Dirk on 7 Feb 2013
Edited: Dirk on 7 Feb 2013
Oh, actually the picture in my first post represents the 3D problem. The values in the matrix are the 'forces' (calculated with 'tau'), plotted on the surface. I'm struggling with the idea to make a 3D plot with axes making an angle different form 90°.

Sign in to comment.


Dirk
Dirk on 7 Feb 2013
Edited: Dirk on 7 Feb 2013
Dear Azzi,
I'm afraid I dont understand all lines of your code. What do you exactly mean with the 't', 'g' and 'r'?
Lets say the new angle between x and y shoul be 60 degrees. The aim is to evaluate funtion 'tau' on basis of the new x and y axes (60°), to plot the surface z = h.x.y on basis of the new x and y axes (60°) and to plot the function tau on the new surface.
Thanks
  1 Comment
Azzi Abdelmalek
Azzi Abdelmalek on 7 Feb 2013
Sorry, it's not t but x, I've edited the answer. 'r' (red) , 'g' (green) are the color of the plots. copy and past the code, then run it. For your 3D plot I will try something

Sign in to comment.


Dirk
Dirk on 7 Feb 2013
Edited: Dirk on 7 Feb 2013
Azzi, I used some lines of your code.
So the z values are now correct. Only the image of the surface is deformed...It should be a rhombus. Somebody knows to solve that issue? Now I'll search to how to plot the values of the funtion 'tau' on the new surface.
h = 0.5;
d = 1;
a = 4;
x= [-a:d:a];
y= [-a:d:a];
[x,y] = meshgrid(x,y);
b=sqrt(3)/2;
a=1/2;
hold on
plot3([0 a],[0 b],[0 0],'g') % new axis
plot3(xlim ,[0 0],[0 0],'r')
%----------New x,y and z in the new coordinate system---
new_x=y*a+x;
new_y=y*b;
hold on,
z =x.*y.*h;
surf(new_x,new_y,z);

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!