

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.


One possibility is to use contour:
https://octave.org/doc/interpreter/Two_002dDimensionalPlots.html#XREFcontour
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 < [hidden email]> 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.


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.^24; 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?
On Mon, Sep 16, 2019 at 4:43 AM Carlo de Falco < [hidden email]> 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 < [hidden email]> 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.


> Il giorno 16 set 2019, alle ore 16:55, Brett Green < [hidden email]> ha scritto:
>
> 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.^24;
> 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
>> F = @(x,y) x.^2+y.^24;
>> [x, y] = meshgrid (linspace (5,5,100));
>> contour (x, y, F(x, y))
have a look at meshgrid in the manual.
c.


> Il giorno 17 set 2019, alle ore 07:02, [hidden email] ha scritto:
>
>
>
>> Il giorno 16 set 2019, alle ore 16:55, Brett Green < [hidden email]> ha scritto:
>>
>> 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.^24;
>> 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
>
>
>
>>> F = @(x,y) x.^2+y.^24;
>>> [x, y] = meshgrid (linspace (5,5,100));
>>> contour (x, y, F(x, y))
>
>
> have a look at meshgrid in the manual.
> c.
BTW, I think the best way to plot the curve you want in the example is
F = @(x, y) x.^2 + y.^2;
contour (x, y, F(x,y), [4 4]);
The form for the last input is not documented clearly in the manual, I
just posted a documentation bug about this here :
https://savannah.gnu.org/bugs/?56907c.


Thank you! The simple, if odd, fix of just using two entries in the argument which sets the contours works fine for me. It's good to know it wasn't because I was misunderstanding something.
> Il giorno 17 set 2019, alle ore 07:02, [hidden email] ha scritto:
>
>
>
>> Il giorno 16 set 2019, alle ore 16:55, Brett Green <[hidden email]> ha scritto:
>>
>> 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.^24;
>> 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
>
>
>
>>> F = @(x,y) x.^2+y.^24;
>>> [x, y] = meshgrid (linspace (5,5,100));
>>> contour (x, y, F(x, y))
>
>
> have a look at meshgrid in the manual.
> c.
BTW, I think the best way to plot the curve you want in the example is
F = @(x, y) x.^2 + y.^2;
contour (x, y, F(x,y), [4 4]);
The form for the last input is not documented clearly in the manual, I
just posted a documentation bug about this here :
https://savannah.gnu.org/bugs/?56907
c.


> Il giorno 20 set 2019, alle ore 00:43, Brett Green < [hidden email]> ha scritto:
>
> Thank you! The simple, if odd, fix of just using two entries in the argument which sets the contours works fine for me. It's good to know it wasn't because I was misunderstanding
> something.
well, it was actually me misunderstanding something :)
it seems this behaviour IS documented but I missed the line in contorur docs about it ...
>
>  Brett Green
c.

