[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Plotting curves defined by implicit functions

**From**: |
kingcrimson |

**Subject**: |
Re: Plotting curves defined by implicit functions |

**Date**: |
Tue, 17 Sep 2019 07:02:26 +0200 |

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