![]() |
您如何在函数句柄上进行符号区分?
说如果我定义以下内容:
g = @(x) x/sqrt(x^2+1) 如何获得g的导数函数,然后可以用它在不同的点求值? 我尝试了符号数学工具包,并尝试了以下方法: >> syms x >> f = x/sqrt(x^2+1) f = x/(x^2 + 1)^(1/2) >> diff(f) ans = 1/(x^2 + 1)^(1/2) - x^2/(x^2 + 1)^(3/2) 但是,我无法弄清楚如何将其转换为函数句柄/在不同点进行评估。但是,我更喜欢在function_handle上进行区分。 非常感谢你! 杰森 [B]回答:[/B] 您可以使用[URL="http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/matlabfunction.html"][B]matlabFunction[/B][/URL]将符号方程式转换为函数。例如: syms x1 x2; f1 = x1^2+x2^2; Df1 = jacobian(f1, [x1 x2]); Df1 = matlabFunction(Df1); 然后Df1(0,0)按预期返回[0 0]。 [URL="http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/matlabfunction.html"][B]matlabFunction[/B][/URL]函数是[URL="http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/rn/brz0m2w-1.html"]在[/URL] [URL="http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/"]Symbolic Math Toolbox的[/URL] [URL="http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/rn/brz0m2w-1.html"]5.2版(R2009a)[/URL]中[URL="http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/rn/brz0m2w-1.html"]引入的[/URL] 。 [url=https://stackoverflow.com/questions/2307705]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 05:02。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.