MATLAB Answers

how to differentiate a function and then evaluate at a predefined variable?

2 ビュー (過去 30 日間)
sam plant
sam plant 2018 年 11 月 6 日
コメント済み: madhan ravi 2018 年 11 月 6 日
If i wanted to differentiate f=x*y with respect to y and then evaluate at a value y = 6 say. how would i do this? i would write the code syms y f=x*y g=diff(f) but then how would i go about the evaluation because it seems y is now fixed as a symbol. Also, i have this as predefined input values x,y so i would like to use the y value predefined as i'm writing it in a function

  0 件のコメント

サインイン to comment.

採用された回答

madhan ravi
madhan ravi 2018 年 11 月 6 日
syms x y
f=x*y
A=diff(f,y)
subs(A,y,6)

  3 件のコメント

madhan ravi
madhan ravi 2018 年 11 月 6 日
If you differentiate f with respect to y the result is x !
sam plant
sam plant 2018 年 11 月 6 日
Thank you! I used that example to just keep it simple, my actual equation was involving logs and 3 variables but i just wanted t keep the principle the same. It's working after reading this, i appreciate the help!
madhan ravi
madhan ravi 2018 年 11 月 6 日
Anytime :) , I understood that you needed an example to know the functions , Happy Matlab(ing)

サインイン to comment.

その他の回答 (0 件)

サインイン してこの質問に回答します。


Translated by