How to obtain the co-efficient of a trigonometric equations?

2 views (last 30 days)
I have a polynomial equation like consider f(x) = x^6+5x^4+x^2, and x is 2cos(A/2). After substituting in the equation, the equation is solved in terms of a0+a1*cos(A)+a2*cos(2A)+a2*cos(3A)..... I need the values for a0,a1,a2..... Do we have any instruction to obtain co-efficient in this case? Please let me know
Thank you

Answers (2)

Walter Roberson
Walter Roberson on 4 Oct 2011
This can be done using indets() and some complicated type expressions. (Maple does a better job with type expressions, in my opinion.)
Easier is probably
newf = subs(f, {cos(A),cos(2*A),cos(3*A)}, {cosA, cos2A, cos3A});
Then you can use
coeff(newf, cos3A)
to find the coefficient corresponding to cos(3*A) (for example.) Just a simple change of variables.

Venkata
Venkata on 4 Oct 2011
How to define the polynomial equation that i asked in previous question?
  5 Comments
Venkata
Venkata on 5 Oct 2011
Hi Walter,
This is the code i have written
syms x A
syms cosA cos2A cos3A
f = 32*(x^6)-48*(x^4)+18*(x^2)-1;
fnew = simplify(subs(f, x, 1.25*cos(A/2)));
fnew2 = subs(fnew, {cos(A),cos(2*A),cos(3*A)}, {cosA, cos2A, cos3A});
OUTPUT:
>> fnew
fnew =
(15625*cos(A)^3)/1024 + (16875*cos(A)^2)/1024 + (1275*cos(A))/1024 - 999/1024
>> fnew2
fnew2 =
(15625*cosA^3)/1024 + (16875*cosA^2)/1024 + (1275*cosA)/1024 - 999/1024
>> coeffs(fnew2,cosA)
ans =
[ -999/1024, 1275/1024, 16875/1024, 15625/1024]
>> coeffs(fnew2,cos2A)
ans =
(15625*cosA^3)/1024 + (16875*cosA^2)/1024 + (1275*cosA)/1024 - 999/1024
>>
I am unable to get the coefficients
Walter Roberson
Walter Roberson on 5 Oct 2011
Well, as I indicated above:
Note: simplify() might not be enough to force the trig substitution in MuPad. In Maple, one would use combine(EXPRESSION,'trig') to do that substitution, but I have not yet found the MuPad equivalent of `combine/trig`

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!