|
I had hoped to restrict my plots using this method to ellipses but it looks like that may not be possible.
When calculating the hyperbolic sections, the equation changes to:
e*sinh(F)-F-M
I would use a simple if funtion to select which fzero to use based on the value of e and I guess that fzero would work for this new equation with e>1?
I will find out when I work on it in the morning!
Thanks for your help.
Cheers,
Chris
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gpeeb9$d54$1@fred.mathworks.com>...
> "Chris " <c.j.crawshaw@googlemail.com> wrote in message <gpe4pm$eos$1@fred.mathworks.com>...
> > Hi, I'm having trouble solving the following equation:
> > M=E-e*sin(E);
> >
> > M and e have 5 values which should result in 5 values of E so that M(1), e(1) -> E(1) etc.
> >
> > I have tried solve, fzero and fsolve but either I exectud them incorrectly or they are the wrong function to solve this equation.
> >
> > The other consideration, is when this is implemented, it will be inside afor loop, generating 5 different values of M for each loop, so I can't realistically manually calculate them for the whole project.
> >
> > Cheers,
> > Chris
>
> The difficulties you might have with this equation depend very much on the magnitude of the e factor. Assuming E is measured in radians, if the absolute value of e is less than or equal to 1, there is always one and only one solution and fzero should be able to find it without much difficulty no matter what initial scalar estimate you give to it.
>
> On the other hand if the absolute value of e is greater than 1, multiple roots become possible, and the larger the magnitude of e, the more roots there can be. With only a scalar initial estimate, this can make fzero appear inconsistent with results that depend on the inner workings of the fzero algorithm. Therefore, if you are working with e values of magnitude greater than 1, you need to devise some strategy for selecting an initial search range for E, as a two-element vector range estimate to hand to fzero, that includes the desired root and none other.
>
> In other words, it is up to you to, in effect, select which root you want in this circumstance. The function fzero cannot read your mind; your loop has got to be made smart enough to perform this action. If it helps any, the successive roots of the equation cos(E)=1/e where the derivative of x-e*sin(x) changes sign (there are infinitely many) will always separate the possible roots of your equation, so the range estimate need only select the interval between the correct two successive roots to cos(E)=1/e.
>
> As for 'solve', my matlab version is totally unable to find any analytic solution and I suspect that will remain true with newer versions.
>
> Roger Stafford
|