Clear Filters
Clear Filters

Binary phase shift keying in MATLAB questions and confusion

28 views (last 30 days)
Hi there,
I have been studying GNSS signals and trying to practice it in MATLAB to understand the core concepts.
GPS use BPSK modulation and I want to implement it in MATLAB to see how does it work
After a little bit of digging I noticed that MATLAB has a built-in function for that i.e. pskmod(x,2)
And the example shown in the documentation has only a message signal i.e. randi([0 1],1, 10) okay! that's understandable but the real question is where is the frequency input?
suppose I want to modulate the pseudorandom code sequence of GPS L1 i.e. 1023 chips of 1 and 0 over a L1 carrier frequency i.e. 1575.42e6 how can I do it? the pskmod function is only taking one value i.e. the message signal.

Answers (1)

Atithi
Atithi on 6 Jul 2023
Generate the pseudorandom code sequence: The GPS L1 pseudorandom code sequence consists of 1023 chips of 1s and 0s. You can generate this sequence using the GPS System Toolbox in MATLAB. However, since the toolbox is not available in this environment, we can create a dummy pseudorandom code sequence using the randi function.
Generate the carrier signal: The carrier frequency for GPS L1 is 1575.42 MHz (1575.42e6 Hz). You can create a carrier signal with this frequency using the cos function.
Perform BPSK modulation: To modulate the pseudorandom code sequence onto the carrier signal, you can use the pskmod function in MATLAB. Since the pskmod function takes a message signal as input, you can use the pseudorandom code sequence as the message signal.
% Generate a dummy pseudorandom code sequence
pseudorandom_sequence = randi([0 1], 1, 1023);
% Define the carrier frequency
carrier_frequency = 1575.42e6;
% Create the carrier signal
t = 0:1/(10*carrier_frequency):(1023-1)/(10*carrier_frequency); % Time vector
carrier_signal = cos(2*pi*carrier_frequency*t);
% Modulate the pseudorandom code sequence using BPSK
modulated_signal = pskmod(pseudorandom_sequence, 2);
% Plot the modulated signal
subplot(2,1,1);
plot(t, modulated_signal);
Warning: Imaginary parts of complex X and/or Y arguments ignored.
title('BPSK Modulated Signal');
xlabel('Time');
ylabel('Amplitude');
% Plot the carrier signal
subplot(2,1,2);
plot(t, carrier_signal);
title('Carrier Signal');
xlabel('Time');
ylabel('Amplitude');
% Adjust subplot spacing
sgtitle('BPSK Modulation');
Let me know if it worked for you.
  1 Comment
Imtiaz nabi
Imtiaz nabi on 6 Jul 2023
Edited: Imtiaz nabi on 6 Jul 2023
I know how to generate prn code but the question is pskmody function is only take prn code so how can it modulate it over the carrier
Also I can't understand what you just did to create a time vector
And the bpsk signal should look like a sine wave with a shifted phase but if we zoom that in I don't think it would matches the shape of a bpsk signal

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!