how to calculate the partial derivatives for a given function of two variable ?
204 ビュー (過去 30 日間)
古いコメントを表示
How can I write code to calculate the partial derivatives a given function of two variable ?
0 件のコメント
回答 (1 件)
Dyuman Joshi
2019 年 12 月 14 日
編集済み: Dyuman Joshi
2023 年 8 月 12 日
Hello, You can use diff function operator to obtain partial derivatives as follows:
1- Define the function using symbolic variables
%Random function for example
syms x y;
f(x,y) = x^2 + y^2 + x*y;
2-use diff with respect to the variable you want to differentiate.
fx = diff(f,x)
fy = diff(f,y)
You can also find the value of parial derivatives by substituting the value -
fx(1,0)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!