plotting data in an non orthogonal coordinate system

조회 수: 20 (최근 30일)
Dirk
Dirk 2013년 2월 7일

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!

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 7일
편집: Azzi Abdelmalek 2013년 2월 7일
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

추가 답변 (4개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 7일
편집: Azzi Abdelmalek 2013년 2월 7일
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 2013년 2월 7일
편집: Dirk 2013년 2월 20일
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
Dirk
Dirk 2013년 2월 7일
편집: Dirk 2013년 2월 7일
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°.
Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 7일
Ok, what is your new coordinate system?

댓글을 달려면 로그인하십시오.


Dirk
Dirk 2013년 2월 7일
편집: Dirk 2013년 2월 7일
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
Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 7일
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

댓글을 달려면 로그인하십시오.


Dirk
Dirk 2013년 2월 7일
편집: Dirk 2013년 2월 7일
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);

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by