How to obtain the co-efficient of a trigonometric equations?
Show older comments
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
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
on 4 Oct 2011
0 votes
5 Comments
Walter Roberson
on 4 Oct 2011
syms x A
f = x^6 + 5*x^4 + x^2;
fnew = simplify(subs(f, x, 2*cos(A/2)));
fnew2 = subs(fnew, {cos(A),cos(2*A),cos(3*A)}, {cosA, cos2A, cos3A});
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`
Venkata
on 5 Oct 2011
Walter Roberson
on 5 Oct 2011
syms cosA cos2A cos3A
Venkata
on 5 Oct 2011
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`
Categories
Find more on Numeric Solvers 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!