Problem using diff comand
Show older comments
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
Answers (1)
Roger Stafford
on 25 Jan 2015
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?
Categories
Find more on Startup and Shutdown 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!