MATLAB|【QSPK图像传输】基于QPSK的多用户图像无线传输matlab仿真

1.软件版本 matlab2013b
2.系统实现 算法流程如下:
MATLAB|【QSPK图像传输】基于QPSK的多用户图像无线传输matlab仿真
文章图片

程序主题如下:

clc; clear; close all; warning off; addpath 'func\' addpath 'func_sub\Spread_and_Channel\' addpath 'func_sub\Channel_Est\' addpath 'func_sub\Receiver\'%读取图像源 %% %图像源 filename1= 'Images\32\1.jpg'; filename2= 'Images\32\2.jpg'; filename3= 'Images\32\3.jpg'; figure; subplot(231); imshow(imread(filename1)); title('User1'); subplot(232); imshow(imread(filename2)); title('User2'); subplot(233); imshow(imread(filename3)); title('User3'); P= 32*32*3*8; %将三个图像源转换为二进制数据 [bitsOut1,x,y]= fImageSource(filename1,P); [bitsOut2,x,y]= fImageSource(filename2,P); [bitsOut3,x,y]= fImageSource(filename3,P); databox= 1024; %产生扩频gold码 %用户一产生gold码 d= 2; shift= [d,d+3,d+6]; [MSeq1]= fMSeqGen([1 0 0 1 1]); [MSeq2]= fMSeqGen([1 1 0 0 1]); %由两个M序列产生GOLD序列 GoldSeq1 = fGoldSeq(MSeq1,MSeq2,shift(1))'; GoldSeq1(find(GoldSeq1==0)) = -1; GoldSeq2 = fGoldSeq(MSeq1,MSeq2,shift(2))'; GoldSeq2(find(GoldSeq2==0)) = -1; GoldSeq3 = fGoldSeq(MSeq1,MSeq2,shift(3))'; GoldSeq3(find(GoldSeq3==0)) = -1; Goldseqs = [GoldSeq1 GoldSeq2 GoldSeq3]; Gold_Num = length(GoldSeq1); J= [zeros(1,(2*Gold_Num-1)) 0; eye(2*Gold_Num-1) zeros((2*Gold_Num-1),1)]; %调制初始参数 phi= pi/4; %定义信噪比 SNR=100; %定义三个用户的信道信息,修改信道参数,即可完成task1,2,3的功能实现 %array Array_Position = [0 0 0; 0 0 0; 0 0 0; 0 0 0; 0 0 0]; %每个用户的多径数,1表示无多径 Path_Num = [1 1 1]'; User_Num = length(Path_Num); %DOA:azimuth, elevation DOA_User1= [200]; DOA_User2= [700]; DOA_User3= [120 0]; DOA= [DOA_User1; DOA_User2; DOA_User3]; %Delay Delay1 = [5]'; Delay2 = [8]'; Delay3 = [11]'; Delay= [Delay1; Delay2; Delay3]; %fading fading1 = [0.9]; fading2 = [0.6]'; fading3 = [0.5]'; Beta= [fading1; fading2; fading3]; %每次发送64个bit,进行循环发送,模拟实际情况 for nframes = 1:P/databox fprintf('Now transmit...%d\n\n',nframes); bits1 = [0 0 bitsOut1(databox*(nframes-1)+1:databox*nframes) 0 0]'; bits2 = [0 0 bitsOut2(databox*(nframes-1)+1:databox*nframes) 0 0]'; bits3 = [0 0 bitsOut3(databox*(nframes-1)+1:databox*nframes) 0 0]'; %QPSK,根据星座图进行映射 QPSK1 =fDSQPSKModulator(bits1,Goldseqs(:,1),phi); QPSK2 =fDSQPSKModulator(bits2,Goldseqs(:,2),phi); QPSK3 =fDSQPSKModulator(bits3,Goldseqs(:,3),phi); %扩频处理 All_Photo = [QPSK1 QPSK2 QPSK3]; %扩频,信道处理 R_Channel = fChannel(Path_Num,All_Photo, DOA, Delay, Beta, Goldseqs, Array_Position, SNR); %信道估计 [DOAest,Delayest] = fChannelEstimation(R_Channel,GoldSeq1,Array_Position,Path_Num(1)); %接收机解扩 R = func_Reciver(R_Channel,DOAest,Delayest,Array_Position,GoldSeq1,Path_Num(1)); %De QPSK DeQPSK = fDSQPSKDemodulator(R,GoldSeq1,phi); %DeQPSK = Decoder(R, 'QPSK'); %最后接收到的数据 Final_Rec(databox*(nframes-1)+1:databox*nframes) = DeQPSK; %传输错误个数 sum(abs(bits1(3:end-2)-DeQPSK')) end%图像还原 subplot(235); I = fImageSink(Final_Rec,P,x,y); title('The receive data of user1'); figure; subplot(121); plot(QPSK1,'o'); grid on axis square; subplot(122); plot(R,'o'); axis square; figure; subplot(141); imshow(imread(filename1)); subplot(142); plot(QPSK1,'o'); grid on axis square; subplot(143); plot(R,'o'); axis square; subplot(144); imshow(uint8(I)); axis square;

3.仿真过程 MATLAB|【QSPK图像传输】基于QPSK的多用户图像无线传输matlab仿真
文章图片

MATLAB|【QSPK图像传输】基于QPSK的多用户图像无线传输matlab仿真
文章图片

40db
MATLAB|【QSPK图像传输】基于QPSK的多用户图像无线传输matlab仿真
文章图片

20 db
MATLAB|【QSPK图像传输】基于QPSK的多用户图像无线传输matlab仿真
文章图片

0 db
MATLAB|【QSPK图像传输】基于QPSK的多用户图像无线传输matlab仿真
文章图片

-10db
MATLAB|【QSPK图像传输】基于QPSK的多用户图像无线传输matlab仿真
文章图片

【MATLAB|【QSPK图像传输】基于QPSK的多用户图像无线传输matlab仿真】A01-63

    推荐阅读