How to calculate the coefficients of non-polynomial terms

5 visualizaciones (últimos 30 días)
T S Singh
T S Singh el 8 de Sept. de 2018
Editada: madhan ravi el 8 de Sept. de 2018
I am trying to find the coefficients of non-polynomial terms
For example
syms x
a=-9*cos(x)*4+x*9+4*sin(x)
I want to find the coefficients of sin(x) and cos(x).
When using coeffs its not working
Thanks

Respuesta aceptada

madhan ravi
madhan ravi el 8 de Sept. de 2018
Editada: madhan ravi el 8 de Sept. de 2018
syms x
a=-9*cos(x)*4+x*9+4*sin(x)
[C,T] = coeffs(a) %edited after John’s comment.
It’s working for me
  11 comentarios
T S Singh
T S Singh el 8 de Sept. de 2018
Yes, Actually I have included a new symbol y in the expression
syms x y
a=-9*y*cos(x)*4+x*9+4*sin(x);
[C,T] = coeffs(a,{sin(x),cos(x),x})
C =
[ 4, -36*y, 9]
T =
[ sin(x), cos(x), x]
Thanks John
madhan ravi
madhan ravi el 8 de Sept. de 2018
Editada: madhan ravi el 8 de Sept. de 2018
if you find it useful please accept the answer, thank you @John

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by