Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

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

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

From: Venkata

Date: 18 Nov, 2011 18:20:11

Message: 1 of 10

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

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

From: Matt J

Date: 18 Nov, 2011 18:38:30

Message: 2 of 10

"Venkata " <goutam_nalamati@yahoo.com> wrote in message <ja67kr$3op$1@newscl01ah.mathworks.com>...
> I have a polynomial equation like consider f(x) = x^6+5x^4+x^2, and x is 2cos(A/2). After substituting x in the equation, the equation can be solved theoritically in terms of a0+a1*cos(A)+a2*cos(2A)+a2*cos(3A)..... I need the values for a0,a1,a2 using the matlab..... Do we have any instruction to obtain co-efficient in this case? Please let me know
================

Why not determine the coefficients of f(x) first using POLYFIT? Once you know the polynomial coefficients, you can deduce the trig coefficients.

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

From: Nasser M. Abbasi

Date: 18 Nov, 2011 19:07:46

Message: 3 of 10

On 11/18/2011 12:20 PM, Venkata wrote:
> I have a polynomial equation like consider f(x) = x^6+5x^4+x^2, and x is 2cos(A/2).
>After substituting x in the equation, the equation can be solved theoritically in
>terms of a0+a1*cos(A)+a2*cos(2A)+a2*cos(3A)..... I need the values
>for a0,a1,a2 using the matlab..... Do we have any instruction to obtain
>co-efficient in this case? Please let me know
> Thank you

may be?

---------------------------------
EDU>> syms a0 a1 a2 A x
EDU>> s=a0+a1*cos(A)+a2*cos(2*A)+a2*cos(3*A);
EDU>> news=subs(s,{cos(A),cos(2*A),cos(3*A)},{x,x^2,x^3})
  
news =
  
a2*x^3 + a2*x^2 + a1*x + a0
  
EDU>> coeffs(news,x)
  
ans =
  
[ a0, a1, a2, a2]

--------------------------

--Nasser

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

From: Roger Stafford

Date: 18 Nov, 2011 19:55:30

Message: 4 of 10

"Venkata " <goutam_nalamati@yahoo.com> wrote in message <ja67kr$3op$1@newscl01ah.mathworks.com>...
> I have a polynomial equation like consider f(x) = x^6+5x^4+x^2, and x is 2cos(A/2). After substituting x in the equation, the equation can be solved theoritically in terms of a0+a1*cos(A)+a2*cos(2A)+a2*cos(3A)..... I need the values for a0,a1,a2 using the matlab..... Do we have any instruction to obtain co-efficient in this case? Please let me know
> Thank you
- - - - - - - - - -
  If I understand your request correctly, you need to use the Symbolic Toolbox to make appropriate substitutions. To start with you have the following trigonometric identities:

 cos(A) = cos(2*A/2) = 2*cos(A/2)^2 - 1
 cos(2*A) = cos(4*A/2) = 8*cos(A/2)^4 - 8*cos(A/2)^2 + 1
 cos(3*A) = cos(6*A/2) = 32*cos(A/2)^6 - 48*cos(A/2)^4 + 18*cos(/2)^2 - 1

In the expression 'a0+a1*cos(A)+a2*cos(2*A)+a3*cos(3*A)' you should make the above substitutions of the right hand sides for the left hand sides. Then wherever cos(A/2) is, substitute 'x/2' and then 'collect' all the like powers of x. Each of the coefficients of x in the result should be the same as those in x^6+5x^4+x^2, which gives you four equations in four unknowns and can be easily solved using the 'solve' function. The result will be an exact set of values for a0, a1, a2, and a3.

Roger Stafford

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

From: Venkata

Date: 18 Nov, 2011 20:16:14

Message: 5 of 10

Thank you all for replying, My theoritcal sovle of that equation always does not end at cos3A, i may also get cos4A, cos5A.... i.e. the coefficents will be a0,a1,a2,a3,a4,a5.... So I need a generalized solution.

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

From: Venkata

Date: 18 Nov, 2011 20:19:29

Message: 6 of 10

This is code that i simulated

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

>>

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

From: Roger Stafford

Date: 18 Nov, 2011 20:23:29

Message: 7 of 10

"Roger Stafford" wrote in message <ja6d7i$o0o$1@newscl01ah.mathworks.com>...
> cos(3*A) = cos(6*A/2) = 32*cos(A/2)^6 - 48*cos(A/2)^4 + 18*cos(/2)^2 - 1
- - - - - - - -
  There is a typo in the third trigonometric identity. It should be:

 cos(3*A) = cos(6*A/2) = 32*cos(A/2)^6 - 48*cos(A/2)^4 + 18*cos(A/2)^2 - 1

Roger Stafford

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

From: Roger Stafford

Date: 18 Nov, 2011 20:36:25

Message: 8 of 10

"Venkata " <goutam_nalamati@yahoo.com> wrote in message <ja6eee$s3u$1@newscl01ah.mathworks.com>...
> Thank you all for replying, My theoritcal sovle of that equation always does not end at cos3A, i may also get cos4A, cos5A.... i.e. the coefficents will be a0,a1,a2,a3,a4,a5.... So I need a generalized solution.
- - - - - - - - -
  If you have even powers of x in f(x) up to x^(2*n), then using the substitution x = 2*cos(A/2), you should always be able to express it in terms of cos(A), cos(2*A), ..., cos(n*A) by generalizing the technique I showed you. Of course you will need the trigonometric identities up to:

 cos(n*A) = cos((2*n)*(A/2)) = {lin. comb. of powers of cos(A/2)}

(I have a general formula for this if you are interested.)

Roger Stafford

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

From: Roger Stafford

Date: 18 Nov, 2011 21:29:27

Message: 9 of 10

  A tantalizing hint: If you follow the procedure I suggested, the value you get for a2 will be 22 with your polynomial f(x) = x^6+5x^4+x^2. I'll leave it to you to find the other three.

Roger Stafford

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

From: Christopher Creutzig

Date: 22 Nov, 2011 10:15:13

Message: 10 of 10

On 18.11.11 19:20, Venkata wrote:
> I have a polynomial equation like consider f(x) = x^6+5x^4+x^2, and x is 2cos(A/2). After substituting x in the equation, the equation can be solved theoritically in terms of a0+a1*cos(A)+a2*cos(2A)+a2*cos(3A)..... I need the values for a0,a1,a2 using the matlab..... Do we have any instruction to obtain co-efficient in this case? Please let me know

>> syms a0 a1 a2 A x
>> f = subs(x^6+5*x^4+x^2, x, 2*cos(A/2));
>> f = feval(symengine, 'combine', f, 'sincos')

f =

22*cos(2*A) + 2*cos(3*A) + 72*cos(A) + 52

% now, *if* f is of this form,
% we can substitute cos(x*A) by A^x and use coeffs ...
>> f2 = subs(f, 'hold(cos)', 't -> A^(t/A)')

f2 =

2*A^3 + 22*A^2 + 72*A + 52

>> coeffs(f2, A)

ans =

[ 52, 72, 22, 2]



Christopher

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us