⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bpsk_qpsk_builtin.m

📁 Mat lab code of OFDM using BPSK
💻 M
字号:

%   -------------
%    TRANSMITTER
%   -------------

clear all
close all

disp('Here is the code of OFDM using (01)=BPSK ......(02) =QPSK. ');
disp('SET M 2 for BPSK & 4 for QPSK. ');

M = input('Enter value of M 2 = BPSK..... 4 = QPSK etc ... =   ');    

bits = input('enter no of bits ....=  '); ;        
nc = input('enter no of carrier....=  ');                 
len_cp = ceil(0.1*nc);  %   length of cyclic prefix
ifft_points = nc;           
fft_points = nc;

data = randsrc(1, bits, 0:M-1);
figure(1)
stem(data); grid on; xlabel('Data Points'); ylabel('Amplitude')
title('Transmitted Data "O"')

modulated_data = pskmod(data, M,pi/4);

scatterplot(modulated_data);

title('QPSK Modulation')

num_cols=length(modulated_data)/nc;

data_matrix = reshape(modulated_data, nc, num_cols);

cp_start = nc-len_cp;
cp_end = nc;


for i=1:num_cols
    ifft_data_matrix(:,i) = ifft((data_matrix(:,i)),ifft_points);
    
    for j=1:len_cp,
       actual_cp(j,i) = ifft_data_matrix(j+cp_start,i);
    end
       ifft_data(:,i) = vertcat(actual_cp(:,i),ifft_data_matrix(:,i));
end

[rows_ifft_data cols_ifft_data]=size(ifft_data);

ofdm_data = rows_ifft_data*cols_ifft_data;

ofdm_signal = reshape(ifft_data, 1, ofdm_data);

figure(3)

plot(real(ofdm_signal)); 
title('Real part of OFDM Signal');grid on;
figure(4)
plot(imag(ofdm_signal)); 
title('Imaginary part of OFDM Signal');grid on;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -