Understanding how Matlab approximations work

1 次查看(过去 30 天)
Dear all,
I have what may be a naive question about how Matlab truly works. I have an ODE whose solution lies on the unit sphere. One of the equilibrium points is (1,0,0). When I look for the equilibrium points using numerical methods, Matlab tells me that the equilibrium point is
1.000000000000000
0
0.000000000000000
When I then try to solve the equation, after some time, the solution of the equation leaves the equilibrium and starts to go around the sphere. But if before solving the equation I specify to Matlab to start from the point
1
0
0
then nothing happens (which is rather normal since the point is an equilibrium one, even if unstable). My question is therefore, why does the solution leave the equilibrium when the starting point is
1.000000000000000
0
0.000000000000000
To me, this was the exact same as
1
0
0
since I thought Matlab did not use more than 16 digits. But I am obviously wrong since the solutions are not the same... Is Matlab hiding me some numerical approximations somewhere?
Thank you very much

回答(1 个)

per isakson
per isakson 2013-4-9
  6 个评论
Pl Pl
Pl Pl 2013-4-9
"the hex output indicates that the two are indeed identical"
Does it? I thought on the contrary that the third component in the hex format was not as expected. To recall things, the coordinates of the equilibrium point using fminsearch in format hex are
3ff0000000000000
0000000000000000
3c91a62633145c07
I thought it should read
3ff0000000000000
0000000000000000
0000000000000000
shouldn't it?
I'm not sure I know how to use the debugger as you propose...
Thank you for your patience.
per isakson
per isakson 2013-4-9
编辑:per isakson 2013-4-9
Communication is tricky. I tried to say that the two sets of inputs are indentical. (I added the word "inputs" in my previous comment.)
>> format hex
>> 1,0,0
ans =
3ff0000000000000
ans =
0000000000000000
ans =
0000000000000000
>> 1.0000, 0.0000, 0.0000
ans =
3ff0000000000000
ans =
0000000000000000
ans =
0000000000000000
>>
Still the two outputs differ.
Did you try to step through the code?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by