Matlab 如何找到给定函数的num和denum?

Matlab 如何找到给定函数的num和denum?,matlab,Matlab,我想将有理函数分离为num和denom: i、 e x*y/(2*z)==>n=x*y d=2*z 这是我的密码: func = input('Enter the function: '); [n d] = numden(func); disp(n); >> test Enter the function: x*y/(2*z) ??? Error using ==> input Undefined function or variable 'y'. Error in ==&

我想将有理函数分离为num和denom: i、 e x*y/(2*z)==>n=x*y d=2*z

这是我的密码:

func = input('Enter the function: ');
[n d] = 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: ');
你必须使用


字符串是否总是以这种形式出现,只有一个斜杠,并且您希望找到左右两侧的部分?它可以是任何形式,例如:x/y/z等于x/(y*z)>>syms x y???对于“char”类型的输入参数,未定义函数或方法“syms”。我认为您需要符号数学工具箱。你安装了吗?
>> syms x y;     
>> [n d] = numden(x*y/(x+y))

n =

x*y


d =

x + y

>>