Thread Subject: Plot "fraction" circle

Subject: Plot "fraction" circle

From: saneman

Date: 21 May, 2008 14:43:44

Message: 1 of 5

Is there some way to plot a circle in matlab divided in 12 even fractions?


Subject: Plot "fraction" circle

From: Adam Chapman

Date: 21 May, 2008 18:25:53

Message: 2 of 5

On May 21, 3:43=A0pm, "saneman" <a...@ad.com> wrote:
> Is there some way to plot a circle in matlab divided in 12 even fractions?=


pie(ones(1,12))

Subject: Plot "fraction" circle

From: saneman

Date: 21 May, 2008 18:38:55

Message: 3 of 5


"Adam Chapman" <adam.chapman@student.manchester.ac.uk> skrev i en meddelelse
news:fbba7301-ca2a-45ac-a300-71bd9ac7101c@25g2000hsx.googlegroups.com...
On May 21, 3:43 pm, "saneman" <a...@ad.com> wrote:
> Is there some way to plot a circle in matlab divided in 12 even fractions?

pie(ones(1,12))

Ok is it possible to get 12 slices but only list: 0, pi/2, pi, 3/2pi, 2pi ?


Subject: Plot "fraction" circle

From: Bob

Date: 22 May, 2008 17:36:02

Message: 4 of 5

It's not clear to me if you want wedges (like slices of pizza) or just
circumferential slices. Either way, you compute draw your own. Hopefully
this attempt at the latter helps.

arcLength = 2*pi/12;
numPoints = 10;
arcPoints = linspace(-arcLength/2,arcLength/2,numPoints);
radius = 1;
clf, axis square, axis off
for k=1:4 %each segment
   theta = (k-1)*pi/2 + arcPoints;
   x = radius*cos(theta);
   y = radius*sin(theta);
   line(x,y)
end

Cheers
Bob

Subject: Plot

From: Matt Fig

Date: 22 May, 2008 19:17:02

Message: 5 of 5


>
> Ok is it possible to get 12 slices but only list: 0, pi/2,
pi, 3/2pi, 2pi ?
>

Using the Line function:


theta = [0,pi/6,pi/3,pi/2];
X = zeros(2,length(theta));
Y = X;
X(2,:) = cos(theta);
Y(2,:) = sin(theta);
X = [X -X -X X];
Y = [Y Y -Y -Y];
lh = line(X,Y);
set(lh(:),'color','k')
x = -1:.001:1;
y1 = sqrt(1-x.^2);
y2 = -y1;
hold on
plot(x,y1,'k',x,y2,'k')
xlim([-1.5 1.5])
ylim([-1.5 1.5])
str = {'Interpreter','latex','FontSize',13,...
       'horizontalalignment','center','Position'};
c1 = {str{:},[1.2 0],'String','$$0,2\pi$$'};
c2 = {str{:},[0 1.2],'String','$${\frac{\pi}{2}}$$'};
c3 = {str{:},[-1.2 0],'String','$$\pi$$'};
c4 = {str{:},[0 -1.2],'String','$${\frac{3\pi}{2}}$$'};
text(c1{:})
text(c2{:})
text(c3{:})
text(c4{:})
axis equal



Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com