Problem using diff comand

1 次查看(过去 30 天)
Adnan Ali
Adnan Ali 2015-1-25
Hi, I am having problem using diff command. I am trying to differentiate following function and matlab is missing 2nd part of answer.
a=90.0 - 90.0*exp(-0.167*t)*cos(1.99*t) - 7.53*exp(-0.167*t)*sin(1.99*t); b=diff(90.0 - 90.0*exp(-0.167*t)*cos(1.99*t) - 7.53*exp(-0.167*t)*sin(1.99*t); vpa(b,3)
ans 181.0*exp(-0.167*t)*sin(1.99*t)
it is missing 0.453e-1*exp(-.167*t)*cos(1.99*t).
Full complete answer which i found using maple is
0.453e-1*exp(-.167*t)*cos(1.99*t)+180.35751*exp(-.167*t)*sin(1.99*t).
Will you please help to figure this out. I am with Matlab.
Thank you,
Adnan

回答(1 个)

Roger Stafford
Roger Stafford 2015-1-25
I am guessing that your difficulty is due to the low number of digits accuracy, namely only 3, that you requested. Write
vpa(b,100)
and see what you get.
Asking for only three decimal digits will probably produce terribly inaccurate results and some terms might be missing altogether. Why have you done this?

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by