Cos wave generation (please help)

Status
Not open for further replies.

Suj

Newbie level 3
Joined
Apr 30, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
India
Activity points
1,304
I have a signal which has 32 samples, Valpha[32] =2.5sin t which i can generate using a function generator , similarly i need to generate Vbeta[32]=2.5cost .. please help on how do i generate a cos wave?? I need to generate sin and cos signals. These signals are then passed to dsPIC30F for further calculations.

This is the formula which i need to implement:
for(i=0;i<32;i++)
{
vp=a*((valpha*sinewave)-(vbeta*coswave));
vq=a*((valpha*coswave)+(vbeta*sinewave));
}

Please help me for a code to implement this on dsPIC30F.
 

As fa as I've understood your question, you can consider the fact that sin(x) is shifted 90deg with respect to cos(x) that means:

cos(x) = sin(x+90deg)

if your 32 samples are 1 period of the sinewave then they represent 360deg, from which 90deg are 32/4=8 samples

so Vbeta[1] = Valfa[8]
Vbeta[2] = Valfa[9]
. .
. .
Vbeta[25] = Valfa[32]

Vbeta[26] = Valfa[1]
. .
. .
Vbeta[32] = Valfa[7]
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…