How to numerically differentiate one function with respect to another?

13 ビュー (過去 30 日間)
Arkadiy Sakhartov
Arkadiy Sakhartov 2017 年 10 月 4 日
編集済み: Roger Stafford 2017 年 12 月 6 日
I have two functions, u(x,y) and v(x,y), that are both intractable analytically and estimated numerically in MATLAB on a grid for x and y. How can I estimate du(x,y)/dv(x,y) at all points (x,y) on the grid? I want to plot du(x,y)/dv(x,y) against x and y.
  1 件のコメント
Roger Stafford
Roger Stafford 2017 年 12 月 6 日
編集済み: Roger Stafford 2017 年 12 月 6 日
@Arkadiy: Your request is rather ambiguous. The derivative of u with respect to v at a given x,y point will in general depend upon which direction in the x,y plane one is moving. In other words, the partial derivative of u with respect to x divided by the partial derivative of v with respect to x, which indicates how u changes with respect to v along the x-axis, is not necessarily the same as the ratio of those two partial derivatives along the y-axis. You need to consider that such a derivative of u with respect to v is a partial derivative which requires two values, one in the x-direction and one in the y-direction.

サインインしてコメントする。

回答 (1 件)

ANKUR KUMAR
ANKUR KUMAR 2017 年 12 月 2 日
There might be some formula based on the theory. Please provide the formula also to help you in a better way. For the time being, here is the simple code to find du/dv,
for i=1:size(U,1)-1
for k=1:size(U,2)-1
C(i,k)=(U(i,k)-U(i+1,k+1))/(U(i,k)-U(i+1,k+1));
end
end
  1 件のコメント
Arkadiy Sakhartov
Arkadiy Sakhartov 2017 年 12 月 5 日
編集済み: Arkadiy Sakhartov 2017 年 12 月 5 日
Thank you for your answer. I have the following two comments on the answer. First, as I explained in my request, there is no formula in the considered setting. It is not tractable analytically. Second, something wrong is with the offered code. Obviously, with that code all C(i,k) = 1.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by