How to get all the coefficients of a polynomial with symbolic coefficients?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
DmArcher
el 28 de Abr. de 2017
Editada: John D'Errico
el 28 de Abr. de 2017
I tried this
syms f1 f2 z
a = (f1-f2)*z^2 + f1*z +1
coeffes(a,z,'all')
I expected to get [f1-f2, f1, 1]But it reports error. Does anyone know any other methods to do this?
0 comentarios
Respuesta aceptada
Star Strider
el 28 de Abr. de 2017
The method you are using is correct. Your spelling of the coeffs function is not.
Try this:
syms f1 f2 z
a = (f1-f2)*z^2 + f1*z + 1;
[cfs,trms] = coeffs(a,z,'all')
cfs =
[ f1 - f2, f1, 1]
trms =
[ z^2, z, 1]
0 comentarios
Más respuestas (1)
John D'Errico
el 28 de Abr. de 2017
Editada: John D'Errico
el 28 de Abr. de 2017
If you type the name of the function properly, it will work.
syms f1 f2 z
a = (f1-f2)*z^2 + f1*z +1;
coeffs(a,z,'all')
ans =
[ f1 - f2, f1, 1]
Based on this and the last question I answered from you, I would suggest learning to be more careful in your typing.
0 comentarios
Ver también
Categorías
Más información sobre Assumptions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!