Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

I/Q samples frequency shifting

Status
Not open for further replies.

Masood_786

Junior Member level 2
Joined
Dec 21, 2010
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,488
Hi
I have downloaded I/Q samples of AM modulated signals (Radio broadcast) that contains 2 stations. one centered at 0 Khz and other at 8 Khz.
I am able to play 0 Khz stations by demodulation. now i want to shift (down-conversion) the 8 Khz signal to 0 Khz. I understand the process and studied various books but by applying what i have studied i am unable to shift frequency. I have done the following
Fs=22050
Fc=-8000 // 8Khz to be shifted to 0 Khz

ph_inc=(2*PI*FC/Fs) for NCO
LO_ph_acc=0

fptr[1024] //it contains I and Q samples interleaved

then in loop i do following
for(int a=0; a<samples_count*2;a+=2)
{
i = fptr[a];
q = fptr[a+1];

LO_ph_acc+=LO_Ph_Inc;
if(LO_ph_acc> (2 * PI) )
LO_ph_acc-=(2 * PI);

i=(i * cos(LO_ph_acc)) - (q* (sin(LO_ph_acc) ) );
q=(q* cos(LO_ph_acc))- (i* (sin(LO_ph_acc) )) +

newfrq[a]=i; //still the frequency is not shifted
newfrq[a+1]=q;
}

In SDR applications like SDRSharp, two stations can be seen and even 8 Khz station shifted to 0 Khz when selected for shifting. Can any one tell mistake in the code.
 

You modify i then use the modified value of i in the q calculation, I don't think this is correct.
Also should not the q line be something more like (q* sin(LO_ph_acc)) - (i * cos....

Please use cut and paste (and [ code ] tags) when copying code into a post, the above has numerous typos.

73 Dan.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top