Skip to content

Instantly share code, notes, and snippets.

@amitsaha
Created April 6, 2012 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitsaha/2319415 to your computer and use it in GitHub Desktop.
Save amitsaha/2319415 to your computer and use it in GitHub Desktop.
Circles
clear all;close all
% radius
for r=1:10
lines=zeros(361,2);
cx=[];cy=[];
for theta=0:360
x=r*cos(theta);
y=r*sin(theta);
cx=[cx;x];
cy=[cy;y];
end
% plot the circle
plot(cx,cy,'r.'); hold on
% lines matrix
lines=[lines cx cy];
% plot the lines
for i=1:size(lines,1)
plot([lines(i,1) lines(i,3)],[lines(i,2) lines(i,4)],'b-');
hold on
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment