输入图像需要经过调制和传输,最后使用 BPSK 进行检测。
M = 2; %Modulation order 2 for BPSK
randn('state',200); % initializing the randn() function
imdata = imread('lenna.pgm');
bdata = de2bi(imdata);
sizec = size(bdata,1); % height
sizer = size(bdata,2); % width
nbits = sizec*sizer; % number of bits in the image
msg = double(reshape(bdata,nbits,1));
以下代码用于调制输入图像并显示解调输出。结果输出,当我运行代码时,我得到一个空白图像。需要帮助找出我错过了什么或哪里出错了。
%modulate
txpsk = pskmod(msg,M);
%noise
phasenoise = randn(nbits,1)*0.015;
rxpsk = txpsk.*exp(2i*pi*phasenoise);
%demodulate
recovpsk = pskdemod(rxpsk,M);
reshape1rxpsk = reshape(recovpsk,sizec,sizer);
reshape2rxpsk = bi2de(reshape1rxpsk);
finalout= reshape(reshape2rxpsk,size(imdata,1),size(imdata,2));
imshow(finalout)