Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

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.
 

albbg

Advanced Member level 4
Joined
Nov 7, 2009
Messages
1,242
Helped
429
Reputation
858
Reaction score
379
Trophy points
1,363
Location
Italy
Activity points
9,412
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top