how to get function value?

조회 수: 84 (최근 30일)
Ani Asoyan
Ani Asoyan 2020년 6월 3일
댓글: Ani Asoyan 2020년 6월 3일
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)

채택된 답변

madhan ravi
madhan ravi 2020년 6월 3일
df(a) = diff(f)
df(2)
  댓글 수: 5
madhan ravi
madhan ravi 2020년 6월 3일
편집: madhan ravi 2020년 6월 3일
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 2020년 6월 3일
oh I'm so bad at matlab :D .. thank you

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

David Hill
David Hill 2020년 6월 3일
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
madhan ravi
madhan ravi 2020년 6월 3일
Nah using eval(...) is o]absolutely not needed here! forget it!
Ani Asoyan
Ani Asoyan 2020년 6월 3일
I agree,, David Hill , thanks for the effort, but I think I'll go with the other answer, sorry

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by