I'm trying to analyze GPS L1 C/A signal on MATLAB. I could generate the PRN codes(binary signals). After I add NAV Data to the PRN code using modulo 2, I need to modulate it using BPSK. I also could it(I am using IF_freq=20 instead of real frequenc=1.5GHz).

For getting the PSD graph of the modulated signal, I correlated it by itself and got FFT of the correlation. But my graph seems wrong, can someone explain why I am getting this graph?

Original spectrum: GPS L1 C/A signal original

My spectrum: My correlation graph and its PSD PSD zoomed in

My MATLAB code:

prn_1_40ms = repmat(prn_1,1,40); %%PRN 1 for 40ms
prn_2_40ms = repmat(prn_2,1,40); %%PRN 2 for 40ms

[PSK_signal,org_data,time_bpsk] = BPSK_Modulation(prn_1);


freq = -Fs/2:Fs/length(PSD):Fs/2-(Fs/length(PSD));

function [mod_sig, org_sig, time_out] = BPSK_Modulation(data)
    %%For BPSK Modulation
    % Enter the two Phase shifts - in Radians
    % Phase for 0 bit
    P1 = 0; 
    % Phase for 1 bit
    P2 = pi;
    freq_L1=20; %Instead of using L1 real frequency, we use lower frequency
    %to make the calculation easier and make the details more appear on the
    freq_Samp=freq_L1*50; %Sampling frequency have to be at least double the
    %carrier frequency. Higher sampling, more resolution.
    PSK_signal = [];
    Digital_signal = [];

    for ii = 1: 1: length(data)

        % The FSK Signal
        PSK_signal = [PSK_signal (data(ii)==0)*cos(2*pi*f*t + P1)+...
            (data(ii)==1)*cos(2*pi*f*t + P2)];
        % The Original Digital Signal
        Digital_signal = [Digital_signal (data(ii)==0)*...
            zeros(1,length(t)) + (data(ii)==1)*ones(1,length(t))];

        time = [time t];
        t =  t + 1;        

    mod_sig = PSK_signal;
    org_sig = Digital_signal;
    time_out = time;
  • $\begingroup$ is that real, received signal from a GPS satellite? $\endgroup$ Nov 20 '19 at 11:50
  • $\begingroup$ The null to null bandwidth for the GPS C/A code is 2.046 MHz. You didn't indicate units but I assume you meant you are trying to simulate it with a 20 MHz IF but it looks like you ended up with 8MHz, and the null to null bandwidth looks even smaller than an 8/20th ratio. I suspect you are not simulating the IF frequency you intended but without seeing your code it is difficult to assess (also there usually is no good reason to simulate the BPSK modulation along with any channel distortions with a real IF instead of a complex baseband-- what is the reason you wanted to include a real IF?) $\endgroup$ Nov 25 '19 at 2:52
  • $\begingroup$ @MarcusMüller No, it is not a real signal. I try to generate a fake signal and verify it by analyzing its FFT graph. $\endgroup$ Dec 1 '19 at 15:21
  • $\begingroup$ @DanBoschen Thank you for the explanation! Actually, I am a newbie in this topic and try to learn the fundamentals by doing practical things. In this example, I tried to generate L1 C/A signal with fake NAV data. It can be funny but I simulate it with a 20 Hz IF, MHz IF also took a lot of time. I included an IF because only one solution I know to make the modulation simpler and faster. $\endgroup$ Dec 1 '19 at 15:35
  • $\begingroup$ @FarukÜNAL Yes you will find that you needn't simulate with any IF--- if you use complex data what is at baseband (f=0) is identical to what is at 20MHz (I am sure that is what you meant) or 1575.42 MHz. Do you simulation with a 0 IF complex valued baseband signal- you can then generate small carrier offsets representing Doppler such as 1 KHz and any other channel impairments, all at baseband. $\endgroup$ Dec 2 '19 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.