Problem using diff comand

1 visualizzazione (ultimi 30 giorni)
Adnan Ali
Adnan Ali il 25 Gen 2015
Risposto: Roger Stafford il 25 Gen 2015
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

Risposte (1)

Roger Stafford
Roger Stafford il 25 Gen 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?

Categorie

Scopri di più su Programming in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by