Getting the coefficients of a function in Matlab syms
1 次查看(过去 30 天)
显示 更早的评论
How would I be able to get the Coefficients of the f function down below and get the Expected Output?
Code:
syms a b
f = expand((a+b)^2)
Expected Output:
1 2 1
0 个评论
回答(1 个)
DGM
2021-11-15
Try
syms a b
f = expand((a+b)^2)
c = coeffs(f) % if you want a symbolic result
c = double(c) % if you want a numeric result
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!