Saturday 15 September 2012

Plot Circle in MATLAB -



Plot Circle in MATLAB -

i asked find different ways plot circle in matlab,

it seems boring. come ideas (some might inefficient!),

method 1

ezpolar(@(x)1);

method 2

t = linspace(0,2*pi,100); plot(sin(t),cos(t));

method 3

[x,y,~] = cylinder(1,100); plot(x(1,:),y(1,:));

method 4

ezplot('x^2 + y^2 - 1');

method 5

theta = linspace(0,2*pi,100); ro = ones(1,100); [x,y] = pol2cart(theta,ro); plot(x,y);

and got interesting.

i'm curious if have other ideas.

thanks.

edit

method 11

azimuth = linspace(-pi,pi,100); r = ones(1,100); elevation = zeros(1,100); [x,y,z] = sph2cart(azimuth,elevation,r); patch(x,y,z) %% (not sure how works! improvement suggestions?)

if you're going go polar coordinates, there's also

method 6

theta = linspace(0,2*pi,100); rho = ones(1,100); polar(theta, rho)

method 7

ezpolar('1') % shortest?

can take advantage complex number , how they're handled plot:

method 8

theta = linspace(0,2*pi,100); rho = ones(1,100); z = rho.*exp(1i*theta); plot(z)

the above done on 1 line. plotted as:

plot(real(z),imag(z))

method 9

plot(0,0,'o','markersize',100)

method 10

text(0,0,'\circ','fontsize',200)

many other unicode characters can used produce circles.

extend generating circles differential equations, e.g., circular orbits , circular limit cycles (hopf oscillator).

matlab plot

No comments:

Post a Comment