Vous êtes sur la page 1sur 2

Aim: To study Phase Shift Keying (PSK) modulator and demodulator in MATLAB Apparatus Required: PSK Modulator circuit,

PSK Demodulator circuit, MATLAB softw are Theory: Phase-shift keying (PSK) is a digital modulation scheme that conveys dat a by changing, or modulating, the phase of a reference signal (the carrier wave) . Any digital modulation scheme uses a finite number of distinct signals to repr esent digital data. PSK uses a finite number of phases, each assigned a unique p attern of binary digits. Usually, each phase encodes an equal number of bits. Ea ch pattern of bits forms the symbol that is represented by the particular phase. The demodulator, which is designed specifically for the symbol-set used by the modulator, determines the phase of the received signal and maps it back to the s ymbol it represents, thus recovering the original data. This requires the receiv er to be able to compare the phase of the received signal to a reference signal - such a system is termed coherent (and referred to as CPSK). Diagrams: MATLAB Code: clc; clear all; close all; %% Message Bits to transmit. msg_bits = [1 0 1 0 1 0 0 0 1 1 0 0 1 0 1]; Tb = 1; % Bit Period (in seconds). %% Carrier Signal. fc = 3; fs = 8000; amp = 5;

% Sampling Frequency. % Carrier Amplitude.

%% Modulate. unipolarNRZ = []; carrierSignal = []; output_psk = []; time_axis = []; tl = 0; for mBit = msg_bits if (mBit == 0) [s, t] = Generate_Sin(amp, fc, tl, tl + Tb, fs); output_psk = [output_psk s]; unipolarNRZ = [unipolarNRZ zeros(1,length(t))]; elseif (mBit == 1) [s, t]= Generate_Cos(amp, fc, tl, tl + Tb, fs); output_psk = [output_psk s]; unipolarNRZ = [unipolarNRZ ones(1,length(t))]; end time_axis = [time_axis t]; tl = tl + 1; end %% Display Modulation Result. subplot(3,1,1); stem(0:length(msg_bits)-1, msg_bits,'b','LineWidth',2); axis([0 time_axis(end) -0.5 1.5]); title('Input Message Bits', 'Fontsize', 14); xlabel('Time'); ylabel('Amplitude'); grid on; subplot(3,1,2); plot(time_axis, unipolarNRZ, 'b', 'LineWidth',2);

axis([0 time_axis(end) -0.5 1.5]); title('Unipolar NRZ', 'Fontsize', 14); xlabel('Time'); ylabel('Amplitude'); grid on; subplot(3,1,3); plot(time_axis, output_psk, 'k', 'LineWidth',2); title('Output PSK', 'Fontsize', 14); xlabel('Time'); ylabel('Amplitude'); grid on; %% Demodulate. rx_bits = length(output_psk) / (fs+1); detected_Bits = zeros(1, rx_bits); time_axis = []; tl = 0; for n = 1 : rx_bits samples = output_psk(n * (fs+1) - (fs+1) + 1 : n*(fs+1)); [bit_0, t] = Generate_Sin(amp, fc, tl, tl + Tb, fs); [bit_1, t] = Generate_Cos(amp, fc, tl, tl + Tb, fs); if(sum(samples - bit_0) == 0) detected_Bits = [detected_Bits 0]; elseif(sum(samples - bit_1) == 0) detected_Bits = [detected_Bits 1]; end time_axis = [time_axis t]; tl = tl + 1; end %% Display Demodulation Result. figure; subplot(2,1,1); plot(time_axis, output_psk, 'k', 'LineWidth',2); title('Received Signal', 'Fontsize', 14); xlabel('Time'); ylabel('Amplitude'); grid on; subplot(2,1,2); stem(0:length(msg_bits)-1, msg_bits,'b','LineWidth',2); axis([0 time_axis(end) -0.5 1.5]); title('Detected Message Bits', 'Fontsize', 14); xlabel('Time'); ylabel('Amplitude'); grid on; Result: Fig. 1 shows the input message bits, the corresponding unipolar non-retu rn to zero signal and the transmitted Phase Shift Keyed signal

Vous aimerez peut-être aussi