Hi I want to evaluate function and its derivative at a=2 , how to do that?
syms a
b=2
e=0.9
q=1.2
g=2
k=3
d=0.5
f=(q*b*e/a-d*e)/((q^2)*(e^2)/a+2*e*g)
diff(f)

 Respuesta aceptada

madhan ravi
madhan ravi el 3 de Jun. de 2020

0 votos

df(a) = diff(f)
df(2)

5 comentarios

Ani Asoyan
Ani Asoyan el 3 de Jun. de 2020
thank you! and what about function ?
madhan ravi
madhan ravi el 3 de Jun. de 2020
The same way
Ani Asoyan
Ani Asoyan el 3 de Jun. de 2020
I do f(2) but it doesn't work
madhan ravi
madhan ravi el 3 de Jun. de 2020
Editada: madhan ravi el 3 de Jun. de 2020
P.S: You have some troubles with copying.
f(a) = (q*b*e/a-d*e)/((q^2)*(e^2)/a+2*e*g)
f(2)
Ani Asoyan
Ani Asoyan el 3 de Jun. de 2020
oh I'm so bad at matlab :D .. thank you

Iniciar sesión para comentar.

Más respuestas (1)

David Hill
David Hill el 3 de Jun. de 2020

0 votos

syms a;
b=2;
e=0.9;
q=1.2;
g=2;
k=3;
d=0.5;
f=(q*b*e/a-d*e)/((q^2)*(e^2)/a+2*e*g);
df=diff(f);
fvals=eval(subs(f,1:10));%evaluate f from 1:10 (if you want actual symetric value eleminate the eval function
dfvals=eval(subs(df,1:10));

3 comentarios

Ani Asoyan
Ani Asoyan el 3 de Jun. de 2020
does eval give approximate value or exact value/?
madhan ravi
madhan ravi el 3 de Jun. de 2020
Nah using eval(...) is o]absolutely not needed here! forget it!
Ani Asoyan
Ani Asoyan el 3 de Jun. de 2020
I agree,, David Hill , thanks for the effort, but I think I'll go with the other answer, sorry

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Centro de ayuda y File Exchange.

Preguntada:

el 3 de Jun. de 2020

Comentada:

el 3 de Jun. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by