transform a radius into a circle

12 ビュー (過去 30 日間)
Nicolas
Nicolas 2014 年 12 月 26 日
コメント済み: Nicolas 2014 年 12 月 28 日

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 日
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 日
The polar plot may be what you want.

Image Analyst
Image Analyst 2014 年 12 月 26 日
  5 件のコメント
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.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by