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:
plotting transcendental etqution set curve

Subject: plotting transcendental etqution set curve

From: RAB John

Date: 1 Aug, 2010 18:52:05

Message: 1 of 9

Hello you Matlab Guru's,

I have 2 transcendental equations in 3 variables (1 degree of freedom). I wish to efficiently plot equation set curve (or multiple curves as uniqness is not promised).

Any suggestions rather than just placing values into one of the variables and "FOR" it?

Thx,
RAB

Subject: plotting transcendental etqution set curve

From: us

Date: 1 Aug, 2010 19:00:24

Message: 2 of 9

"RAB John" <dkkddkkd@walla.com> wrote in message <i34fol$59u$1@fred.mathworks.com>...
> Hello you Matlab Guru's,
>
> I have 2 transcendental equations in 3 variables (1 degree of freedom). I wish to efficiently plot equation set curve (or multiple curves as uniqness is not promised).
>
> Any suggestions rather than just placing values into one of the variables and "FOR" it?
>
> Thx,
> RAB

rather than words: show some ML code CSSMers can play with...

us

Subject: plotting transcendental etqution set curve

From: RAB John

Date: 1 Aug, 2010 19:53:07

Message: 3 of 9

"us " <us@neurol.unizh.ch> wrote in message <i34g87$55c$1@fred.mathworks.com>...
> "RAB John" <dkkddkkd@walla.com> wrote in message <i34fol$59u$1@fred.mathworks.com>...
> > Hello you Matlab Guru's,
> >
> > I have 2 transcendental equations in 3 variables (1 degree of freedom). I wish to efficiently plot equation set curve (or multiple curves as uniqness is not promised).
> >
> > Any suggestions rather than just placing values into one of the variables and "FOR" it?
> >
> > Thx,
> > RAB
>
> rather than words: show some ML code CSSMers can play with...
>
> us

cos(x1)+3cos(x2)-2cos(x3) = pi/3
-2cos(x1)+cos(2x2)+cos(x3) = pi/6

This equation set definitely have at least one curve as a solution. I wish to plot it wisely.

Subject: plotting transcendental etqution set curve

From: us

Date: 1 Aug, 2010 20:03:05

Message: 4 of 9

"RAB John" <dkkddkkd@walla.com> wrote in message <i34jb3$etm$1@fred.mathworks.com>...
> "us " <us@neurol.unizh.ch> wrote in message <i34g87$55c$1@fred.mathworks.com>...
> > "RAB John" <dkkddkkd@walla.com> wrote in message <i34fol$59u$1@fred.mathworks.com>...
> > > Hello you Matlab Guru's,
> > >
> > > I have 2 transcendental equations in 3 variables (1 degree of freedom). I wish to efficiently plot equation set curve (or multiple curves as uniqness is not promised).
> > >
> > > Any suggestions rather than just placing values into one of the variables and "FOR" it?
> > >
> > > Thx,
> > > RAB
> >
> > rather than words: show some ML code CSSMers can play with...
> >
> > us
>
> cos(x1)+3cos(x2)-2cos(x3) = pi/3
> -2cos(x1)+cos(2x2)+cos(x3) = pi/6
>
> This equation set definitely have at least one curve as a solution. I wish to plot it wisely.

now, show CSSM how you derive the solution...

us

Subject: plotting transcendental etqution set curve

From: Roger Stafford

Date: 1 Aug, 2010 20:27:06

Message: 5 of 9

"RAB John" <dkkddkkd@walla.com> wrote in message <i34jb3$etm$1@fred.mathworks.com>...
> > > I have 2 transcendental equations in 3 variables (1 degree of freedom). I wish to efficiently plot equation set curve (or multiple curves as uniqness is not promised).
> > > ......
> cos(x1)+3cos(x2)-2cos(x3) = pi/3
> -2cos(x1)+cos(2x2)+cos(x3) = pi/6
> ........
- - - - - - - - - - - -
  For this particular pair of equations, my advice would be to set a parameter t equal to cos(x2) and replace cos(2*x2) with its equal, 2*t^2-1. Then your two equations are linear in cos(x1) and cos(x3), so each of these cosines can be explicitly solved in terms of t. If you then let t vary from -1 to +1, all of these values for which cos(x1) and cos(x3) also both lie between -1 and +1 will furnish solutions for your equations using the acos function. In general there will be eight solutions within the range -pi to +pi for each such t, or one solution for the range 0 to +pi. You can use plot3 to plot these in terms of t.

Roger Stafford

Subject: plotting transcendental etqution set curve

From: John D'Errico

Date: 1 Aug, 2010 21:00:22

Message: 6 of 9

"RAB John" <dkkddkkd@walla.com> wrote in message <i34jb3$etm$1@fred.mathworks.com>...
> "us " <us@neurol.unizh.ch> wrote in message <i34g87$55c$1@fred.mathworks.com>...
> > "RAB John" <dkkddkkd@walla.com> wrote in message <i34fol$59u$1@fred.mathworks.com>...
> > > Hello you Matlab Guru's,
> > >
> > > I have 2 transcendental equations in 3 variables (1 degree of freedom). I wish to efficiently plot equation set curve (or multiple curves as uniqness is not promised).
> > >
> > > Any suggestions rather than just placing values into one of the variables and "FOR" it?
> > >
> > > Thx,
> > > RAB
> >
> > rather than words: show some ML code CSSMers can play with...
> >
> > us
>
> cos(x1)+3cos(x2)-2cos(x3) = pi/3
> -2cos(x1)+cos(2x2)+cos(x3) = pi/6
>
> This equation set definitely have at least one curve as a solution. I wish to plot it wisely.

The solution set (which does exist) will be a 1-manifold,
(actually, a set of disjoint 1-manifolds) curves that lie in
the R^3 space (x1,x2,x3). These curves each look rather
like a bent ellipse, folded in half upon themselves.

John

Subject: plotting transcendental etqution set curve

From: Roger Stafford

Date: 1 Aug, 2010 22:45:22

Message: 7 of 9

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <i34n96$j33$1@fred.mathworks.com>...
> "RAB John" <dkkddkkd@walla.com> wrote in message <i34jb3$etm$1@fred.mathworks.com>...
> > cos(x1)+3cos(x2)-2cos(x3) = pi/3
> > -2cos(x1)+cos(2x2)+cos(x3) = pi/6
> >
> The solution set (which does exist) will be a 1-manifold,
> (actually, a set of disjoint 1-manifolds) curves that lie in
> the R^3 space (x1,x2,x3). These curves each look rather
> like a bent ellipse, folded in half upon themselves.
>
> John
- - - - - - - - - - -
  Yes I agree, John, though it is almost like a square outline in 3D with rounded corners and bent roughly ninety degrees around a diagonal. (And mirror images of this going off to infinity in all three directions.)

  I wonder if those equations are really what the OP wanted. I can't help feeling that the pi quantities in them would hint at equations that were meant to involve inverse cosines in some way.

Roger Stafford

Subject: plotting transcendental etqution set curve

From: RAB John

Date: 2 Aug, 2010 14:48:06

Message: 8 of 9

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i34te2$827$1@fred.mathworks.com>...
> "John D'Errico" <woodchips@rochester.rr.com> wrote in message <i34n96$j33$1@fred.mathworks.com>...
> > "RAB John" <dkkddkkd@walla.com> wrote in message <i34jb3$etm$1@fred.mathworks.com>...
> > > cos(x1)+3cos(x2)-2cos(x3) = pi/3
> > > -2cos(x1)+cos(2x2)+cos(x3) = pi/6
> > >
> > The solution set (which does exist) will be a 1-manifold,
> > (actually, a set of disjoint 1-manifolds) curves that lie in
> > the R^3 space (x1,x2,x3). These curves each look rather
> > like a bent ellipse, folded in half upon themselves.
> >
> > John
> - - - - - - - - - - -
> Yes I agree, John, though it is almost like a square outline in 3D with rounded corners and bent roughly ninety degrees around a diagonal. (And mirror images of this going off to infinity in all three directions.)
>
> I wonder if those equations are really what the OP wanted. I can't help feeling that the pi quantities in them would hint at equations that were meant to involve inverse cosines in some way.
>
> Roger Stafford

Hi you guys,

Thx a lot!
BTW, no inverse function roger. This equation set is exactly what I'm working on.
I eventually ended up with setting one of the variable as parameter (just a3 not the whole cos) and fsolved the remaining equation set (2 equations 2 variables). I rapped it all in a FOR loop and plotted it uusing plot3.

Subject: plotting transcendental etqution set curve

From: Alan B

Date: 2 Aug, 2010 22:13:04

Message: 9 of 9

"RAB John" <dkkddkkd@walla.com> wrote in message <i36lr6$9mo$1@fred.mathworks.com>...
> "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i34te2$827$1@fred.mathworks.com>...
> > "John D'Errico" <woodchips@rochester.rr.com> wrote in message <i34n96$j33$1@fred.mathworks.com>...
> > > "RAB John" <dkkddkkd@walla.com> wrote in message <i34jb3$etm$1@fred.mathworks.com>...
> > > > cos(x1)+3cos(x2)-2cos(x3) = pi/3
> > > > -2cos(x1)+cos(2x2)+cos(x3) = pi/6
> > > >
> > > The solution set (which does exist) will be a 1-manifold,
> > > (actually, a set of disjoint 1-manifolds) curves that lie in
> > > the R^3 space (x1,x2,x3). These curves each look rather
> > > like a bent ellipse, folded in half upon themselves.
> > >
> > > John
> > - - - - - - - - - - -
> > Yes I agree, John, though it is almost like a square outline in 3D with rounded corners and bent roughly ninety degrees around a diagonal. (And mirror images of this going off to infinity in all three directions.)
> >
> > I wonder if those equations are really what the OP wanted. I can't help feeling that the pi quantities in them would hint at equations that were meant to involve inverse cosines in some way.
> >
> > Roger Stafford
>
> Hi you guys,
>
> Thx a lot!
> BTW, no inverse function roger. This equation set is exactly what I'm working on.
> I eventually ended up with setting one of the variable as parameter (just a3 not the whole cos) and fsolved the remaining equation set (2 equations 2 variables). I rapped it all in a FOR loop and plotted it uusing plot3.

Just out of curiosity - is there a versatile, robust algorithm for solving this problem given two arbitrary surfaces? We have marching squares for f(x,y)=k, and marching cubes for f(x,y,z)=k, is there anything so nice for this intersection problem?

I suppose you could find each voxel that contains a section of both surfaces, then compute the piecewise-line-segment intersection curves going through those voxels. Is there anything better?

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