help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to draw an ellipse using Octave


From: Carlo De Falco
Subject: Re: How to draw an ellipse using Octave
Date: Thu, 17 Jan 2019 14:37:37 +0000


> On 17 Jan 2019, at 15:22, Pantxo <address@hidden> wrote:
> 
> Or you can draw the ellipse yourself, which is not much longer:
> 
> rx = 10; ry = 2;
> 
> dx = linspace (0, rx, 100);
> dy = ry*sqrt (1-(dx./rx).^2);
> 
> x = [dx fliplr(dx) -dx -fliplr(dx)];
> y = [dy -fliplr(dy) -dy fliplr(dy)];
> plot (x, y)
> 
> Pantxo

Or, using a parametric representation :

rx = 10; ry = 2;
theta = linspace (0, 2*pi, 1000);
x = rx * cos (theta);
y = ry * sin (theta);
plot (x, y);

c.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]