Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
level curves

Subject: level curves

From: m y

Date: 8 Jan, 2009 12:30:05

Message: 1 of 4

Hi dears
How to plot a level curve and the exact point of intersection between two different level curves.
I ploted the level curves and their point of intersection but that is not exact.

f(x,y)=m (first level curve with m as a parameter)
g(x,y)=n (second level curve with n as a parameter)
in both cases x and y varies from 0 to 1.
one way is
We will fix one level curve (say for m=0.5), and check the level curve intersection for n zero to 1. similarly we change m and again check the point of intersection b/W these level curves.

I am interested in the tangential situation,I need those values of (x,y)where both curves are tangent to eachother.

Subject: level curves

From: John D'Errico

Date: 8 Jan, 2009 13:02:01

Message: 2 of 4

"m y" <ailojee@gmail.com> wrote in message <gk4rkc$94k$1@fred.mathworks.com>...
> Hi dears
> How to plot a level curve and the exact point of intersection between two different level curves.
> I ploted the level curves and their point of intersection but that is not exact.
>
> f(x,y)=m (first level curve with m as a parameter)
> g(x,y)=n (second level curve with n as a parameter)
> in both cases x and y varies from 0 to 1.
> one way is
> We will fix one level curve (say for m=0.5), and check the level curve intersection for n zero to 1. similarly we change m and again check the point of intersection b/W these level curves.
>
> I am interested in the tangential situation,I need those values of (x,y)where both curves are tangent to eachother.

This will be somewhat difficult to solve in general.

Most simple tools that will generate a level curve
will do so in a piecewise linear form. For example, a
contour plot uses a piecewise linear approximation.
How will you find a shared tangent for a pair of
piecewise linear curves that are piecewise linear?

So if you are to make this work, you must use
splines for the curves. This will take some work,
since now you must do a nonlinear search for a
shared tangent between two splines. Since that
optimization will surely have multiple local minima,
you will need to use a global search.

There are many things in mathematics that are
easy to state yet will take some effort to accomplish.
This would seem to be one of them.

John

Subject: level curves

From: Bruno Luong

Date: 8 Jan, 2009 13:21:02

Message: 3 of 4

"m y" <ailojee@gmail.com> wrote in message <gk4rkc$94k$1@fred.mathworks.com>...


> I am interested in the tangential situation,I need those values of (x,y)where both curves are tangent to eachother.

If the level curves are tangent, that means the gradients are colinear.

If you can compute the gradients for both function at the grid points, compute their phases (arguments), make an 2D unwapping (not sure there exists a ready-to-use algorithm in Matlab) do the substraction of unwrap phases, and take the set of points (for example using level) where the difference of phases are 0 (mod pi).

Bruno

Subject: level curves

From: Roger Stafford

Date: 8 Jan, 2009 16:58:02

Message: 4 of 4

"m y" <ailojee@gmail.com> wrote in message <gk4rkc$94k$1@fred.mathworks.com>...
> Hi dears
> How to plot a level curve and the exact point of intersection between two different level curves.
> I ploted the level curves and their point of intersection but that is not exact.
>
> f(x,y)=m (first level curve with m as a parameter)
> g(x,y)=n (second level curve with n as a parameter)
> in both cases x and y varies from 0 to 1.
> one way is
> We will fix one level curve (say for m=0.5), and check the level curve intersection for n zero to 1. similarly we change m and again check the point of intersection b/W these level curves.
>
> I am interested in the tangential situation,I need those values of (x,y)where both curves are tangent to eachother.

  For your tangential problem, as Bruno states, the level curves will be tangent at an intersection provided their respective gradient directions are parallel, or equivalently, provided their tangent vectors are parallel. If you possess partial derivatives for f and g, this can be expressed as df/dx*dg/dy = df/dy*dg/dx. This gives a single condition to be satisfied and therefore in general represents some sort of one-dimensional curve. To find such a curve, all I can think of is to set one of the parameters m or n, or one of the coordinates x or y, to various discrete values and use something like 'fsolve' to use the two corresponding equations to find the coordinates x and y. Repeated calls to 'fsolve' would then presumably find your "tangential" curve as a series of x and y pairs. As John has stated, it doesn't sound like an easy problem,.

  As for the non-tangential intersections between the level curves, every point (x,y) is an intersection for some m and n. Just evaluate f(x,y) = m and g(x,y) = n and you have an intersection. Presumably you would like to find such intersections in terms of, say, a mesh of discrete m and n pairs, which would be another way to use 'fsolve' repeatedly. Very repeatedly indeed; each m, n pair would require a call!

  If you only know f(x,y) and g(x,y) for a discrete set of x,y pairs, the problem becomes even more difficult. You would have to set up some sort of function that 'fsolve' could call on which involves a table of these known discrete pair values along with a two dimensional interpolation formula to be used in a vector manner. Not easy to do and very time consuming.

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us