Skip to main content

Posts

Showing posts with the label pskmod

Constellation Diagram of QPSK

    QPSK = 4-PSK. Each symbol in QPSK consists of 2 bits. MATLAB Script   clc;   clear all;   close all;   M = 4; % constellation size = 4   data = randi([0 (M-1)], 2520, 1);   Phase = 0;   QPSKData=pskmod(data,M,Phase);   scatterplot(QPSKData);   title('constellation diagram of qpsk') Output          Constellation points are 1+0.j, 0+j, -1+0.j, 0-j     Copy the MATLAB Code from here   clc; clear all; close all; M = 4; % constellation size = 4 data = randi([0 (M-1)], 2520, 1); Phase = 0; QPSKData=pskmod(data,M,Phase); scatterplot(QPSKData); title('constellation diagram of qpsk')

How to Plot BER vs SNR Graph in MATLAB

MATLAB Code clc; clear all; close all; snr = 0:2:16; for i = 1:length(snr) rng(10) M = 8; % M = 2, 4, 8, 16, 32, etc. N_Bits = 2520; Phase = 0; data_info_bit = randi([0,1],N_Bits,1); data_temp = bi2de(reshape(data_info_bit,N_Bits/log2(M),log2(M))); modData = pskmod(data_temp,M,Phase); rxData2 = awgn(modData, snr(i)); Received_info = pskdemod(rxData2,M,Phase); Received_info2 = de2bi(Received_info); Received_info2 = [Received_info2(:,1)' Received_info2(:,2)' Received_info2(:,3)']              errors(i) = [(sum(xor(data_info_bit', Received_info2)))] err_ber_fram(i) = errors(i)/length(Received_info2) end semilogy(snr, err_ber_fram,'-*','LineWidth',2); title(sprintf('8-PSK')) ylabel('BER'); xlabel('SNR in dB');grid on   Output       Copy the MATLAB Code from here   clc; clear all; close all; snr = 0:2:16; for i = 1:length(snr) rng(10) M = 8; % M = 2, 4, 8, 16, 32, etc. N_Bits = 2520; Phase = 0; data_info_bit = ...

Common mistakes using the 'pskmod' command in MATLAB

  Sometimes, students incorrectly write code for phase shift keying modulation (PSK). They want to modulate the input bits. For example  Method 1 N_Bits = 2520; % number of input bits M = 4; Phase = 0; % intial phase input_bits = randi([0,1],N_Bits,1); modData = pskmod(input_bits,M,Phase); The above approach is correct once you're performing binary PSK or BPSK. The following code will work for higher-order modulation like 4-PSK, 8-PSK, 16-PSK, or 32-PSK.  Method 2 N_Bits = 2520; % number of input bits M = 4; input_bits = randi([0,1],N_Bits,1); data_temp = bi2de(reshape(input_bits,N_Bits/log2(M),log2(M))); modData = pskmod(data_temp,M,Phase); Another good approach is to generate random bits like this.  Method 3 N_Symbols = 1000; % number of input symbols M = 4; Phase = 0; % intial phase input_symbols = randi([0,(M-1)],N_Symbols,1); modData = pskmod(input_symbols,M,Phase); However, the above method could be more practical. It would be best to map input bits into symbol...

MATLAB Code for 8-PSK, 16-PSK, ...

📘 Overview & Theory 🧮 MATLAB Code for BPSK, QPSK, 8-PSK, 16-PSK, 32-PSK 🧮 Simulator for m-ary PSK 📚 Further Reading   MATLAB Code for BPSK, QPSK, 8-PSK, 16-PSK, 32-PSK clc; clear all; close all; rng(10) M = 8; % M = 2, 4, 8, 16, 32, etc. N_Bits = 2520; Phase = 0; data_info_bit = randi([0,1],N_Bits,1); data_temp = bi2de(reshape(data_info_bit,N_Bits/log2(M),log2(M))); modData = pskmod(data_temp,M,Phase); figure(1); scatterplot(modData); channelAWGN = 15; rxData2 = awgn(modData, channelAWGN); figure(2); scatterplot(rxData2); demodData = pskdemod(rxData2,M,Phase);   for BPSK, Constellation Size, M = 2 for QPSK, M = 4 for 8-PSK, M = 8, and so on    Output Figure: 8-PSK Modulation Figure: 8-PSK Demodulation after adding AWGN Noise Using the above MATLAB code you'll able be to modulate and demodulate 2-PSK, 4-PSK, 8-PSK, 16-PSK, 32-PSK and so on.  16-PSK   Fig: 16-PSK In this above code ' M ' is the number of the conste...

MATLAB Code for QPSK Modulation and Demodulation

📘 Overview 🧮 MATLAB Codes 🧮 Theory 🧮 BER performance of QPSK with BPSK, 4-QAM, 16-QAM, 64-QAM, 256-QAM, etc 📚 Further Reading QPSK Passband Signal Generation Spectral Efficiency in QPSK   Quadrature Phase Shift Keying (QPSK) is a digital modulation scheme that conveys two bits per symbol by changing the phase of the carrier signal. Each pair of bits is mapped to one of four possible phase shifts: 0°, 90°, 180°, or 270° 00  ===> 0 degree phase shift of carrier signal 01  ===> 90 degree 11  ===> 180 degree 10  ===> 270 degree   MATLAB Script clc; clear all; close all; clc; M = 4; data = randi([0 (M-1)], 1000, 1); Phase = 0; modData=pskmod(data,M,Phase); figure(1); scatterplot(modData); channelAWGN = 15; rxData2 = awgn(modData, channelAWGN); figure(2); scatterplot(rxData2); demodData = pskdemod(rxData2,M,Phase);   Result data 1 0 2 2 0 2 1 . . . modData -1.0...


Contact Us

Name

Email *

Message *