Solving a nonlinear equation on matlab R2012a
Show older comments
I'm trying to solve a nonlinear equation on matlab. I'm using the function solve to do it, and after verification what I obtain aren't the right solutions.
This is what I wrote in matlab :
%%Useful values for the calculations
D=86164.10035; % duration of a sideral day (sec)
Re=6378138; % radius of the Earth (e)
J2=0.00108263; % Earth deformation influences
mu_E=3.98600441*10^14; % graviational parameter Earth (m^3/s^2)
e=0;
i = 15*pi/180;
k = 3;
j = 40;
%%Semi major axis "a"
syms a
T(a)=2*pi*sqrt(a^3/mu_E);
deltaL1(a)=(-2)*pi*T(a)/D;
deltaL2(a)=(-3)*pi*J2*Re^2*cos(i)/(a^2*(1-e^2)^2);
A=solve(k==(j*abs(deltaL1(a)+deltaL2(a)))/(2*pi),a,'Real',true)
The solution with the " 'Real',true " fonction was :
A =
943710.16924008730200649507572759
Without :
A =
7572662.5771599009722826970853375 (Not the same as before ?)
- 12858.987803761713442993952602193 - 908401.52028648147433219045549694*i
- 3788906.3000410295504286118766369 + 6428593.6444488438299687193189407*i
15433.999264840777730257286570323 + 936383.5745267034963576894317922*i
- 12858.987803761713442993952602193 + 908401.52028648147433219045549694*i
15433.999264840777730257286570327 - 936383.57452670349635768943179219*i
- 3788906.3000410295504286118766369 - 6428593.6444488438299687193189407*i
Using another software to solve this equation (Maple), we find :
9.437105072*10^5,
7.421392664*10^6, (This is what we expect to find)
-3.713271702*10^6+6.559621323*10^6*I,
-3.713271702*10^6-6.559621323*10^6*I,
-12858.67353+9.084028479*10^5*I,
-12858.67353-9.084028479*10^5*I
Do you have any idea of what is going on here ? If you need more information on what I did, please ask. Any help is greatly appreciated,
Thanks
Answers (0)
Categories
Find more on Systems of Nonlinear Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!