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:
transcendental equations

Subject: transcendental equations

From: hasan

Date: 21 Dec, 2011 17:21:08

Message: 1 of 3

can anybody solve this..
1-2cos(5a) +2cos(5b)=0;
1-2cos(3a)+2cos(3b)=0;
we have to find a and b.

Thanks

Subject: transcendental equations

From: John D'Errico

Date: 21 Dec, 2011 22:36:08

Message: 2 of 3

"hasan" wrote in message <jct4i3$ias$1@newscl01ah.mathworks.com>...
> can anybody solve this..
> 1-2cos(5a) +2cos(5b)=0;
> 1-2cos(3a)+2cos(3b)=0;
> we have to find a and b.

It is clearly homework, something that you should do yourself.
So what have you done?

John

Subject: transcendental equations

From: Roger Stafford

Date: 22 Dec, 2011 17:32:07

Message: 3 of 3

"hasan" wrote in message <jct4i3$ias$1@newscl01ah.mathworks.com>...
> can anybody solve this..
> 1-2cos(5a) +2cos(5b)=0;
> 1-2cos(3a)+2cos(3b)=0;
> we have to find a and b.
- - - - - - - - - -
  Hasan, since you are solving for two unknowns, the first thing that comes to mind is the 'fsolve' function in the Optimization Toolbox which can solve equations in more than one unknown. If you were to solve, say, your second equation for 'b' in terms of 'a', and substitute it into the first equation, you could use 'fzero' in the regular matlab package which handles a single equation in a single unknown. The trouble with both of these methods is making appropriate initial estimates of the solutions so as to, say, find all solutions lying within the range from -pi to +pi. It is easy to miss solutions. (Note that all other solutions outside this range must be equal to a value within the range upon the addition or subtraction of a multiple of 2*pi.)

  The first thing to notice is that if you have found a solution pair (a,b) in which both lie within the range 0 to pi, then by changing one or both their signs, you immediately have three more pairs of solutions, so it is only necessary to solve for angles in the first two quadrants (0 to pi) to get all solutions lying in -pi to +pi.

  The next thing to observe is that the second equation is quite capable of being solved for b in terms of a if approached correctly. The equation can be written as

 cos(3*b) = cos(3*a)-1/2

If b is in the range 0 to 1/3*pi, the solution is

 b1 = 1/3*acos(cos(3*a)-1/2) .

If b is between 1/3*pi and 2/3*pi, it is

 b2 = 1/3*(2*pi-acos(cos(3*a)-1/2))

and if between 2/3*pi and pi, it is

 b3 = 1/3*(2*pi+acos(cos(3*a)-1/2))

Any one of these is a possible solution for 'b' with a given 'a' (provided cos(3*a)-1/2 is not below -1.)

  Using this approach you can use 'fzero' with three different 'b' solutions. To find all the roots in the first quadrant, 0 to pi, you can make some appropriate plots, something along the following lines.

 a = linspace(0,pi,500);
 a = a((cos(3*a)-1/2) > -1); % Avoid complex values for b

Then calculate b1, b2, and b3 as above and substitute in the first equation:

 f1 = 1 - 2cos(5*a) + 2cos(5*b1);

and similarly for f2 and f3. If you then plot each of these 'f' quantities against 'a' using the corresponding b, you should be able to make excellent initial estimates for using 'fzero' by observing the zero crossings. (In your plots you should use only marker symbols without connecting lines so as to avoid confusing straight lines connecting discontinuity gaps.)

Roger Stafford

Tags for this Thread

No tags are associated with 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