please let me have a help with the 'solve' command
Show older comments
in the following is:
i = sqrt(-1)
pi= 3.1416
syms m fi real
assumeAlso( fi>=0 )
assumeAlso( fi<2*pi )
31-december-2016
Dear Sir
please let me have a help with the 'solve' command.
I have two running installation, one is matlab R2009a and the other is matlab R2016a.
So , i noted a different behavior of the command 'solve' between the two version of matlab when i attempt to solve this little equation:
m*exp(i*fi) = -2
with the constraint that both m and fi must be real.
This equation has only 2 sets of real solutions:
1st set : {m=-2 fi=0}
2nd set : {m=2 fi=pi}
now , the R2009a find exactly this sets of solutions, instead the R2016a not.
I tried including some parameter in the command string , such as 'IgnoreAnalyticCostraints' or 'MaxDegree', but i was not able to force R20016a to obtain these complete solutions.
Please take a look at the image screenshot here enclosed where show both Matlab versions at work , with the different solutions obtained, note R2061a obtain only the 1st set : {m=-2 fi=0}
please let me know the right steps for obtain the solution {m=2 fi=pi} also in the R2016a
Thank you
Kind Regards

Accepted Answer
More Answers (1)
Star Strider
on 1 Jan 2017
There have probably been some version changes in the solve function in the last 7 years.
This works (in R2016b):
syms m fi real
Eqn = m*exp(i*fi) == -2;
[m,fi] = solve(Eqn)
m =
pi
0
fi =
2
-2
Categories
Find more on Code Performance 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!