How to use poly2list for specific variables?
5 次查看(过去 30 天)
显示 更早的评论
Hi there,
In the example 2 of the help for 'poly2list' https://www.mathworks.com/help/symbolic/mupad_ref/poly2list.html?s_tid=srchtitle, it shows as follows:
In this example the polynomial is bivariate, thus exponent vectors are returned:
poly2list((x*(y + 1))^2, [x, y])
How to use this in MATLAB? I tried feval but it shows error:
>> syms x y
>> feval(symengine, 'poly2list', (x*(y + 1))^2, [x, y])
Error using mupadengine/feval (line 163)
The number of arguments is incorrect.
Thanks,
Dan
0 个评论
采纳的回答
Walter Roberson
2017-11-30
symLIST = @(varargin)feval(symengine,'DOM_LIST',varargin{:});
feval(symengine,'poly2list', (x*(y + 1))^2, symLIST(x,y))
5 个评论
Walter Roberson
2017-11-30
varcell = num2cell(X);
feval(symengine,'poly2list', (x*(y + 1))^2, symLIST(varcell{:}))
更多回答(1 个)
Karan Gill
2017-11-30
编辑:Karan Gill
2017-12-5
In general, I don't recommend using MuPAD commands, as the note at the top says.
Is coeffs helpful?
>> syms x y
p = (x*(y + 1))^2;
[C,T] = coeffs(p,[x y]) % C = coeffs, T = terms
C =
[ 1, 2, 1]
T =
[ x^2*y^2, x^2*y, x^2]
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!