Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
plot a circle

Subject: plot a circle

From: Raymond

Date: 29 Oct, 2010 16:47:05

Message: 1 of 3

Plot a blue circle with a radius of 2. For the theta, use 100 evenly
spaced values between 0 and 2*pi (inclusive).

My code:
t = linspace(0,2*pi,100);
h=0;
k=0;
r=2;
x = r*cos(t)+h;
y = r*sin(t)+k;
plot(x,y);
axis square;

Is this correct?

Subject: plot a circle

From: Sean

Date: 29 Oct, 2010 17:07:04

Message: 2 of 3

"Raymond " <atlantaswagsurfers3@yahoo.com> wrote in message <iaetq9$sf8$1@fred.mathworks.com>...
> Plot a blue circle with a radius of 2. For the theta, use 100 evenly
> spaced values between 0 and 2*pi (inclusive).
>
> My code:
> t = linspace(0,2*pi,100);
> h=0;
> k=0;
> r=2;
> x = r*cos(t)+h;
> y = r*sin(t)+k;
> plot(x,y);
> axis square;
>
> Is this correct?

I don't know is it?

Subject: plot a circle

From: Matt Fig

Date: 29 Oct, 2010 17:25:08

Message: 3 of 3

One way to check is to look at a simpler case which your eyes can verify easily. Why not try it with a smaller number of evenly spaced points?


% Your code!!
t = linspace(0,2*pi,4); % 4 equally spaced points!!!??
h=0;
k=0;
r=2;
x = r*cos(t)+h;
y = r*sin(t)+k;
plot(x,y,'*','markersize',6);
axis square;

Now look at the plot, does this look right to you?

Tags for this Thread

No tags are associated with this thread.

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.

Contact us