MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何找到给定函数的num和denum? (https://www.labfans.com/bbs/showthread.php?t=26472)

poster 2019-12-14 20:13

如何找到给定函数的num和denum?
 
我想将有理函数分离为num和denom:即x * y /(2 * z)===> n = x * yd = 2 * z

这是我的代码:

func = input('Enter the function: '); [nd] = numden(func); disp(n); >> test Enter the function: x*y/(2*z) ??? Error using ==> input Undefined function or variable 'y'. Error in ==> test at 1 func = input('Enter the function: ');

[B]回答:[/B]

您必须使用[URL="http://www.mathworks.com/help/toolbox/symbolic/syms.html"]符号对象[/URL] 。

>> syms xy; >> [nd] = numden(x*y/(x+y)) n = x*y d = x + y >>

[url=https://stackoverflow.com/questions/5182740]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 18:26

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.