How to make circular Ring?

조회 수: 27 (최근 30일)
mk_ballav
mk_ballav 2015년 2월 14일
편집: Jeremy Simpson 2015년 2월 14일
i want to make a ring. I have two circles of smaller and bigger radius and I want to substract smaller circle from bigger circle to make a ring. Please help me.
I have the code attached here.
L = 40; % Length of rectangle W = 80; % Width of rectangle angle = 0:2*pi/360:2*pi; % Angle of bending C = [L/2 0]; % centre of circle Rin = 15; %radius of inner circle Rout = 1.2*Rin; % Radius of outer circle
%% - boundary of the structure --------------------------------- xv1 = [0 0 0 0 L L 0]; % co-ordinate of rectangle yv1 = [-W/2 -W/2 W/2 W/2 W/2 -W/2 -W/2]; % co-ordinate of rectangle inc = [Rin*cos(angle')+L/2 Rin*sin(angle')]; % co-ordinate of inner circle ouc = [Rout*cos(angle')+L/2 Rout*sin(angle')]; % co-ordinate of inner circle
figure(1);plot(xv1,yv1);axis equal tight;hold on; figure(1);plot(inc(:,1),inc(:,2));axis equal tight;hold on; figure(1);plot(ouc(:,1),ouc(:,2));axis equal tight;hold on

채택된 답변

Image Analyst
Image Analyst 2015년 2월 14일
편집: Image Analyst 2015년 2월 14일
Can't you just use the code in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_ring.3F

추가 답변 (1개)

Jeremy Simpson
Jeremy Simpson 2015년 2월 14일
편집: Jeremy Simpson 2015년 2월 14일
Try this script:
clear,clc
R = 3; %outer radius
r = 2; %inner radius
steps = 100;
theta = 0:2*pi/steps:2*pi;
r_outer = ones(size(theta))*R;
r_inner = ones(size(theta))*r;
rr = [r_outer;r_inner];
theta = [theta;theta];
xx = rr.*cos(theta);
yy = rr.*sin(theta);
zz = zeros(size(xx));
surf(xx,yy,zz)
It may or may not help. I wasn't really sure what you were wanting.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by