- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello again, I am still struggling with BPSK demodulation :)
OK, now I am trying to implement Costas Loop for carrier synchronization, which involves Inphase and Quadrature Phase paths. Inphase is looking good, and works as expected, however, the Q component looks awkward. Take a look at these waveforms: http://www.alteraforum.com/forum/attachment.php?attachmentid=10363&stc=1 I understand that multiplying sin * cos will produce a high frequency component, which is a sin modulated by half amplitude of the data signal. BPSK(t) * sin(2*pi*f*t) = 0.5 * [DATA(t) * sin(0) + DATA(t) * sin(2*pi*f*t)] => 0.5 * DATA(t) * sin(2*pi*f*t) => LPF{0.5 * DATA(t) * sin(2*pi*f*t)} = 0 I feel that problem is in my LPF. I used the same Matched RRC filter that I used in the in-phase arm. Papers I read didn't mention that these two filters should be different, that's why I used the same filter. (I think those are unpractical DSP writers, KAZ :D ) So, should I use a separate Loop Filter for Q component? How do I determine it's parameters?- Tags:
- matlab
Link Copied
- « Previous
- Next »
66 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- The difficulty here is to understand these two concepts (freq and phase). If you can control phase of two different freqs you control both. freq and phase. If you control freq only you control freq ONLY. --- Quote End --- This exactly what I'm doing and think I've done. Costas loop is meant to give PHASE error which happens to be very sensitive to small differences (2 times delta theta). And as you've just said, controlling phase means controlling both freq and phase. --- Quote Start --- Your 1st design requires somebody else to control freq (apparently as we couldn't see any useful sense of error to be useful to push signal to baseband) but if given two inputs at same freq centre then it does give enough error to lock to one quadrant of cycle. To test it keep rf and nco freqs at .1 then change the phase rf and see error. --- Quote End --- The later design is pretty much the first one except that I used a loop filter now, and it seemed that I tested phase offsets in a wrong way in the first design (maybe it was good and working... anyway, this is better). I tested as you said, I set RF and NCO at 0.05, then changed the phase of NCO by pi/8, pi/7, pi/3 and it demodulated and locked in all tests. Do I say Yuppie now? :D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yuppie Yupp. Is that Uni project? I won't tell anybody
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Yuppie Yupp. Is that Uni project? I won't tell anybody --- Quote End --- Yuppieeeeeeeeeeeeeeeeeeeeee!! I am always afraid from your comments to have my designs wrong LOL! But this one is the best :D Yes it is my graduation project... Titled "SoC FPGA-Based Software-Defined Radio" and I think you deserve to mention your name in the thanks page :D Why won't you tell anybody? Hhhhhhhhhh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
In this one, you are using a rf-signal (cosine wave). How this one can be BPSK signal? 1.What is inside RRC.mat? 2.How did you choose Bandwith = 200 hz. Please reply to my questions. --- Quote Start --- Hello Kazem :) I think I did it this time. Please take your time and test it at your leisure before judging :D
clear
clc
load RRC.mat
fc = 0.1 % 0.11 %0.09
rf_signal = cos(2*pi*(1:5000)*0.1);
N = length(rf_signal);
bb = zeros(1, N);
bb_f = zeros(1, N);
I_f = zeros(1, N);
Q_f = zeros(1, N);
I_r = zeros(1, N);
Q_r = zeros(1, N);
error = zeros(1, N);
PhErr = zeros(1, N);
error_integral = zeros(1, N);
Theta = zeros(1, N);
% Loop Filter Coefficients
BW = 200; % Hz
loop_theta = 2*pi*BW;
C1 = 4*(loop_theta)^2/(1+sqrt(2)*loop_theta+loop_theta^2);
C2 = 2*sqrt(2)*loop_theta/(1+sqrt(2)*loop_theta+loop_theta^2);
for i = 2:N
% Downconverting to Baseband
bb(i) = rf_signal(i).*exp(j*2*pi*fc*i).*exp(j*Theta(i-1));
% Filtering
bb_f = filter(RRC, bb(1:i));
I_f(i) = real(bb_f(i));
Q_f(i) = imag(bb_f(i));
% Slicing
if I_f(i) > 0
I_r(i) = 1;
else
I_r(i) = -1;
end
if Q_f(i) > 0
Q_r(i) = 1;
else
Q_r(i) = -1;
end
% Error
error(i) = I_f(i) .* Q_r(i) - Q_f(i) .* I_r(i);
% Loop Filter
error_integral(i) = error(i).*C1 + error_integral(i-1);
PhErr(i) = error(i).*C2 + error_integral(i);
% Phase Accumulator
Theta(i) = Theta(i-1) + PhErr(i);
end
figure
subplot 221
plot(real(bb))
title('I Channel')
subplot 222
plot(imag(bb))
title('Q Channel')
subplot 223
plot(I_f)
title('I Channel Filter')
subplot 224
plot(Q_f)
title('Q Channel Filter')
figure; subplot 311; plot(error); title('Phase Error');
subplot 312; plot(PhErr); title('Loop Filter');
subplot 313; plot(Theta); title('Control Signal \theta');
Just to motivate you, look at these signals: http://www.alteraforum.com/forum/attachment.php?attachmentid=10422&stc=1 http://www.alteraforum.com/forum/attachment.php?attachmentid=10423&stc=1 --- Quote End ---
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
- Next »