How to create a ring using meshgrid with user defined radius ?

13 ビュー (過去 30 日間)
Israr Ul Haq
Israr Ul Haq 2016 年 9 月 28 日
コメント済み: Israr Ul Haq 2016 年 10 月 4 日
I want to make a ring using meshgrid with user defined radius. Thanks

採用された回答

KSSV
KSSV 2016 年 9 月 28 日
編集済み: KSSV 2016 年 9 月 28 日
clc; clear all ;
M = 10 ;
N = 100 ;
R1 = 0.5 ; % inner radius
R2 = 1 ; % outer radius
nR = linspace(R1,R2,M) ;
nT = linspace(0,2*pi,N) ;
%nT = pi/180*(0:NT:theta) ;
[R, T] = meshgrid(nR,nT) ;
% Convert grid to cartesian coordintes
X = R.*cos(T);
Y = R.*sin(T);
[m,n]=size(X);
% Plot grid
figure
set(gcf,'color','w') ;
axis equal
axis off
box on
hold on
% Plot internal grid lines
for i=1:m
plot(X(i,:),Y(i,:),'k','linewidth',1.5);
end
for j=1:n
plot(X(:,j),Y(:,j),'k','linewidth',1.5);
end
You may check the link:
  11 件のコメント
KSSV
KSSV 2016 年 10 月 3 日
I am curious to know...why you are specific about single output?
Israr Ul Haq
Israr Ul Haq 2016 年 10 月 4 日
I have 3D data and I want to correlate the 2D ring matrix with each slice of 3D data.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2016 年 10 月 3 日

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by