This MATLAB script generates a Binary Phase Shift Keying (PSK) signal using two phase shifts for a random bit stream of length 8. It defines parameters such as frequency, sampling rate, and time for one bit, and then plots both the PSK signal and the original digital signal. The script visualizes the PSK signal with two phase shifts and the corresponding digital representation over time.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views2 pages
Practical 13
This MATLAB script generates a Binary Phase Shift Keying (PSK) signal using two phase shifts for a random bit stream of length 8. It defines parameters such as frequency, sampling rate, and time for one bit, and then plots both the PSK signal and the original digital signal. The script visualizes the PSK signal with two phase shifts and the corresponding digital representation over time.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Practical 13
% MATLAB Script for a Binary PSK with two Phases
format long; % Clear all variables and close all figures clear all; close all; % The number of bits to send - Frame Length N = 8; % Generate a random bit stream bit_stream = round(rand(1, N)); % Enter the two Phase shifts - in Radians % Phase for 0 bit P1 = 0; % Phase for 1 bit P2 = pi; % Frequency of Modulating Signal f = 3; % Sampling rate - This will define the resolution fs = 100; % Time for one bit t = 0: 1/fs : 1; % This time variable is just for plot time = []; PSK_signal = []; Digital_signal = []; for ii = 1:1:length(bit_stream) % The PSK Signal PSK_signal = [PSK_signal, (bit_stream(ii) == 0) * sin(2*pi*f*t + P1) + ... (bit_stream(ii) == 1) * sin(2*pi*f*t + P2)]; % The Original Digital Signal Digital_signal = [Digital_signal, (bit_stream(ii) == 0) * ... zeros(1, length(t)) + (bit_stream(ii) == 1) * ones(1, length(t))]; % Update time vector for plotting time = [time, t + (ii - 1)]; end % Plot the PSK Signal subplot(2, 1, 1); plot(time, PSK_signal, 'LineWidth', 2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('PSK Signal with two Phase Shifts'); axis([0 time(end) -1.5 1.5]); grid on; % Plot the Original Digital Signal subplot(2, 1, 2); plot(time, Digital_signal, 'r', 'LineWidth', 2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('Original Digital Signal'); axis([0 time(end) -0.5 1.5]); grid on;