How to create a ring using meshgrid with user defined radius ?
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Israr Ul Haq
el 28 de Sept. de 2016
Comentada: Israr Ul Haq
el 4 de Oct. de 2016
I want to make a ring using meshgrid with user defined radius. Thanks
0 comentarios
Respuesta aceptada
KSSV
el 28 de Sept. de 2016
Editada: KSSV
el 28 de Sept. de 2016
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 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!