help-octave
[Top][All Lists]

## Re: Plotting curves defined by implicit functions

 From: Brett Green Subject: Re: Plotting curves defined by implicit functions Date: Mon, 16 Sep 2019 10:55:03 -0400

Thank you! I've used contours for this before, and was wondering if there was an alternative method streamlined for level curves, but that's probably just a pipe dream.

On that subject, though, I have an issue with contour. Either I'm doing something mathematically inane or I'm misunderstanding how to call the function. I rune the code:

F = @(x,y) x.^2+y.^2-4;
x=linspace(-5,5,100);
y=x;
for k=1:100
for j=1:100
Fmat(k,j) = F(x(k),y(j));
end
end
contour(x,y,Fmat,0)

and get

warning: division by zero
warning: called from
__contour__ at line 167 column 11
contour at line 74 column 18

I thought I asked for a contour where Fmat=0, which should be a circle of radius 2. What am I missing here?

- Brett Green

On Mon, Sep 16, 2019 at 4:43 AM Carlo de Falco <address@hidden> wrote:
One possibility is to use contour:

For example to plot the curve defined by the implicit equation

F(x,y)=0

One could use

contour (x, y, F(x,y),0)

I suspect this might be the approach taken internally by ezplot, but it might give you more control over options.

c.

Il 14 set 2019 20:48, Brett Green <address@hidden> ha scritto:
ezplot is one way to plot curves defined implicitly, but I would like to find something more flexible. I didn't find anything while searching around.

Does anyone know of an alternative, or just know how ezplot works? I tried reading the code and could not follow the details.

- Brett Green