I have some data along a line in a Cartesian coordinate. I know I can transform the Cartesian into polar coordinates using cart2pol. I would like to know how could I create a grid to map a quarter circle with the data along the initial line (to have a top view)?

thank you

댓글 수: 1

Nicolas
Nicolas 2014년 12월 26일
편집: Nicolas 2014년 12월 26일
I have rho (2991*1), data (2991*1), and I created theta = (0:0.5:90)*pi/180; to represent a quarter of a circle. I can mesh rho and theta together using meshgrid. but then I don't know how to use my data to be correlated to the mesh?

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

 채택된 답변

Nicolas
Nicolas 2014년 12월 28일

1 개 추천

here is the solution:
%%Example data
x = (2:0.1:8);
data = sin(x);
%%Shift the values towards the center, so you get a circle instead of an annulus.
x = x-min(x);
%%Your meshgrid generation code.
rho = x;
theta = (0:0.5:90)*pi/180;
[th, r] = meshgrid(theta, rho);
%%Plotting the values
surf(r.*cos(th), ...
r.*sin(th), ...
repmat(data(:), 1, size(th,2)), ...
'linestyle', 'none');
view(2);
axis equal tight;
colorbar;

추가 답변 (2개)

Star Strider
Star Strider 2014년 12월 26일

0 개 추천

The polar plot may be what you want.
Image Analyst
Image Analyst 2014년 12월 26일

0 개 추천

댓글 수: 5

Nicolas
Nicolas 2014년 12월 27일
thank you. I'm not sure it is answering my question though. As i wrote i can create a mesh that has the shape of a quarter of a circle, however I'm not sure how to apply the data I originally have on a line to the mesh.
Image Analyst
Image Analyst 2014년 12월 27일
So you have the coordinates of the arc (quarter circle). OK, fine. But I don't know what it means to "apply the data" to it? Do you mean like you want an image where the pixel gray levels along the arc are those specified in your "data"? Let's say you have 500 (x,y) points covering the arc, and 500 data points with some value that represents something (which I don't know what it is). Now what? Please clarify.
Nicolas
Nicolas 2014년 12월 28일
I added an picture of my problem. I think it is easier like that as I'm not sure how to explain properly. thank you
Image Analyst
Image Analyst 2014년 12월 28일
What do you want out? An image (2D array)? A plot/graph?
All I can think of was a not very efficient method based on the FAQ. I hesitate to show it because it's not fast, efficient, or clever. Hopefully someone else will come up with a fast and clever method.
Nicolas
Nicolas 2014년 12월 28일
thank you, I didn't know how to explain properly what I wanted. by digging I found out the repmat option.. and that's what I was looking for.

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

카테고리

도움말 센터File Exchange에서 Polar Plots에 대해 자세히 알아보기

질문:

2014년 12월 26일

댓글:

2014년 12월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by