ilaplace confusing - result from command window and from m file gui is not the same

2 次查看(过去 30 天)
Hi,
I write in command window:
ilaplace((0.99984898859777815438576453743735*s^2 + 1414.0*s - 414151.01140222184561423546256265)/((s + 1000.0)*(s^2 + 1000000.0)))
And I got : ans =
(199002808534433793169*cos(1000*t))/140737488355328000000 - 58286573144567511919/(140737488355328000000*exp(1000*t)) - (1169*sin(1000*t))/140737488355328000000
I write the same in m file from GUI and I got:
0.707*exp(1000.0*t*i) - 0.41415101140222184561423546256265/exp(1000.0*t) + 0.707*(1/exp(1000.0*t*i))
WHY I GOT COMPLEX NUMBER? "i"?

采纳的回答

Mischa Kim
Mischa Kim 2014-1-21
编辑:Mischa Kim 2014-1-21
Hello John, it is actually the same. Try plotting the two results.
The reason you get complex numbers is because of Euler's formula:
exp^(ix) = cos(x) + i*sin(x)
If you analyze the results you'll see that you get (really) small imaginary numbers. That's because the computation is done in floating point arithmetic (see this answer). In case you are not comfortable with the imaginary parts, just plot the real parts.
  12 个评论
john
john 2014-2-25
编辑:john 2014-2-27
Sorry, but for relative little number simplify doesn't help.
In command window I it is OK, I get:
>> r=simplify(ilaplace(-((4280819729186186979044460847261*s^2)/51422017416287688817342786954917203280710495801049370729644032 + (994733177774077628149071673933*s)/50216813883093446110686315385661331328818843555712276103168 - 949357667952072971550917252451/1569275433846670190958947355801916604025588861116008628224)/((3*s + 200)*(s^2 + 98596))))
r =
19981467697883435869/(3970734387895709337413208929317684822969348320657408*exp((200*t)/3)) - (694227838351497933185*cos(314*t))/21177250068777116466203780956360985722503191043506176 - (11693735405742169632973*sin(314*t))/831207065199501821298498402537168689608250248457617408
But in guide I get:
r=simplify(ilaplace(-((4280819729186186979044460847261*s^2)/51422017416287688817342786954917203280710495801049370729644032 + (994733177774077628149071673933*s)/50216813883093446110686315385661331328818843555712276103168 - 949357667952072971550917252451/1569275433846670190958947355801916604025588861116008628224)/((3*s + 200)*(s^2 + 98596))))
r =
3.0679013785265445477520983725365*10^(-35)*dirac(t)
Why? It is sooo bad!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by