フィルターのクリア

Differentiation Of A Function.

2 ビュー (過去 30 日間)
Pranjal Pathak
Pranjal Pathak 2012 年 1 月 10 日
Hi
I have a symbolic function,
S=sqrt(8).*(3.*X.^3+3.*Y.^2.*X-2.*X);
I need to differentiate it w.r.t X and Y. I did this by-
Tx=diff(S,X);
Ty=diff(S,Y);
I simply got the expression of the differentiation but I need to find the value of the differentiation w.r.t X and Y where X and Y varies from -1 to +1 in steps of 128 (i.e.X=-1:2/127:+1; Y=-1:2/127:+1;[X ,Y]=meshgrid(-1:2/127:+1,-1:2/127:+1);). So, can anyone please help me in finding out the value of the differentiation at all those mentioned points?
Thanking You!

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 1 月 12 日
syms X Y real
S=sqrt(8).*(3.*X.^3+3.*Y.^2.*X-2.*X);
F = jacobian(S,[X,Y]);
Fun = arrayfun(@(i1)matlabFunction(F(i1)),1:2,'un',0);
solution
[x,y] = meshgrid(linspace(-1,1,128));
p = cellfun(@(z)z(x,y),Fun,'un',0);
[dSdx,dSdy] =p{:};
  1 件のコメント
Pranjal Pathak
Pranjal Pathak 2012 年 9 月 7 日
Thanks a lot!It really did solve my problem.

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

その他の回答 (1 件)

Andrew Newell
Andrew Newell 2012 年 1 月 10 日
You could do the following (I tack num onto the name to indicate it is numerical, not symbolic):
Xnum = linspace(-1,1,128); Ynum = Xnum;
[Xnum,Ynum] = meshgrid(Xnum,Ynum);
Txnum = double(subs(Tx,[X,Y],{Xnum,Ynum}));
Tynum = double(subs(Ty,[X,Y],{Xnum,Ynum}));

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by