How could I rewrite a symbolic equation to obtain coefficients?

5 views (last 30 days)
Hi,
I have this equation :
Z=cos(2*P)*((cos(2*A)/2 - cos(2*S)/2)*(cos(2*C)^2 + sin(2*C)^2*cos(Dc)) - (sin(2*A)*sin(2*S)*cos(D)*(cos(2*C)... with many other mathematical terms!
I would write this equation as
Z=A+B*cos(2*C)+C*sin(2*C)+D*cos(4*C)+E*sin(4*C)
My ultimate aim is to collect the coefficients A, B, C, D and E.
Thank you for any help!

Answers (1)

Walter Roberson
Walter Roberson on 15 Jan 2016
You might be able to use coeff() but I have seen hints that the Symbolic Toolbox is not forgiving if the expression is not a true polynomial in the variable.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!