您现在的位置:首页 >> 通信 >> 内容

OFDM图像传输系统matlab仿真,以图片作为数据源进行发送,接收端还原图片,对比MPSK,MQA

时间:2023/2/14 23:17:14 点击:

  核心提示:A367...

1.完整项目描述和程序获取

>面包多安全交易平台:https://mbd.pub/o/bread/ZJWUm59t

>如果链接失效,可以直接打开本站店铺搜索相关店铺:

点击店铺

>如果链接失效,程序调试报错或者项目合作可以加微信或者QQ联系。

2.部分仿真图预览







3.算法概述

        移动视频图像传输,广泛用于公安指挥车、交通事故勘探车、消防武警现场指挥车和海关、油田、矿山、水利、电力、金融、海事,以及其它的紧急、应急指挥系统,主要作用是将现场的实时图像传输回指挥中心,使指挥中心的指挥决策人员如身临其境,提高决策的准确性和及时性,提高工作效率。下面就移动视频图像传输采用公网和专用技术两种情况作相关介绍。

4.部分源码

............................................................................

sym_rem = mod(mod_order-mod(length(im_bin),mod_order),mod_order);

padding = repmat('0',sym_rem,1);

im_bin_padded = [im_bin;padding];

cons_data = reshape(im_bin_padded,mod_order,length(im_bin_padded)/mod_order)';

cons_sym_id = bin2dec(cons_data);

% BPSK

if mod_order == 1

    mod_ind = 2^(mod_order-1);

    n = 0:pi/mod_ind:2*pi-pi/mod_ind;

    in_phase = cos(n);

    quadrature = sin(n);

    symbol_book = (in_phase + quadrature*1i);

end

 

% Phase shift keying about unit circle 

if mod_order == 2 || mod_order == 3

    mod_ind = 2^(mod_order-1);

    n = 0:pi/mod_ind:2*pi-pi/mod_ind;

    in_phase = cos(n+pi/4);

    quadrature = sin(n+pi/4);

    symbol_book = (in_phase + quadrature*1i);

end

 

%16QAM, 64QAM

if mod_order == 4 || mod_order == 6

    mod_ind = sqrt(2^mod_order);

    %n = 0:pi/mod_ind:2*pi-pi/mod_ind;

    in_phase = repmat(linspace(-1,1,mod_ind),mod_ind,1);

    quadrature = repmat(linspace(-1,1,mod_ind)',1,mod_ind);

    symbol_book = (in_phase(:) + quadrature(:)*1i);

end

 

%32QAM

if mod_order == 5

    mod_ind = 6;

    %n = 0:pi/mod_ind:2*pi-pi/mod_ind;

    in_phase = repmat(linspace(-1,1,mod_ind),mod_ind,1);

    quadrature = repmat(linspace(-1,1,mod_ind)',1,mod_ind);

    symbol_book = (in_phase(:) + quadrature(:)*1i);

    symbol_book = symbol_book([2:5 7:30 32:35]); %corners are removed

end

 

%modulate data according to the symbol_book

X = symbol_book(cons_sym_id+1);

 

 

fft_rem = mod(n_fft-mod(length(X),n_fft),n_fft);

X_padded = [X;zeros(fft_rem,1)];

X_blocks = reshape(X_padded,nfft,length(X_padded)/nfft);

x = ifft(X_blocks);

 

%Add cyclic prefix entension and shift from parallel to serial

x_cpe = [x(end-n_cpe+1:end,:);x];

x_s   = x_cpe(:);

 

 

data_pwr = mean(abs(x_s.^2));

 

% Add noise to the channel

noise_pwr = data_pwr/10^(snr/10);

noise = normrnd(0,sqrt(noise_pwr/2),size(x_s))+normrnd(0,sqrt(noise_pwr/2),size(x_s))*1i;

x_s_noise = x_s + noise;

 

 

snr_meas = 10*log10(mean(abs(x_s.^2))/mean(abs(noise.^2)));

 

 

g = exp(-(0:n_taps-1));

g = g/norm(g);

x_s_noise_fading = conv(x_s_noise,g,'same');

 

%% Use FFT to move to frequency domain

% Remove cyclic prefix extension and shift from serial to parallel

x_p = reshape(x_s_noise_fading,nfft+n_cpe,length(x_s_noise_fading)/(nfft+n_cpe));

x_p_cpr = x_p(n_cpe+1:end,:);

 

% Move to frequency domain

X_hat_blocks = fft(x_p_cpr);

 

 

%% Estimate channels

if n_taps > 1

    switch(ch_est_method)

        case 'none'

        case 'LS'

            G = X_hat_blocks(:,1)./X_blocks(:,1);

            X_hat_blocks = X_hat_blocks./repmat(G,1,size(X_hat_blocks,2));

    end

end

 

%% Symbol demodulation

% remove fft padding 

X_hat = X_hat_blocks(:);

X_hat = X_hat(1:end-fft_rem);

 

%Recover data from modulated symbols

A=[real(symbol_book) imag(symbol_book)];

if (size(A,2)>2)

    A=[real(symbol_book)' imag(symbol_book)'];

end

rec_syms = knnsearch(A,[real(X_hat) imag(X_hat)])-1;

 

%Parse to binary stream to remove symbol padding

rec_syms_cons = dec2bin(rec_syms);

rec_im_bin = reshape(rec_syms_cons',numel(rec_syms_cons),1);

rec_im_bin = rec_im_bin(1:end-sym_rem);

ber = sum(abs(rec_im_bin-im_bin))/length(im_bin);

 

%% recover image

% rec_im = reshape(rec_im_bin,9,numel(rec_im_bin)/8);

rec_im = reshape(rec_im_bin,8,numel(rec_im_bin)/8);

rec_im = uint8(bin2dec(rec_im'));

rec_im = reshape(rec_im,size(im));

 

%% generate plots

% transmit constellation

subplot(2,2,1);

plot(X,'x','linewidth',2,'markersize',10);

xlim([-2 2]);

ylim([-2 2]);

xlabel('In phase')

ylabel('Qudrature')

...............................................................

A367

作者:我爱C编程 来源:我爱C编程
本站最新成功开发工程项目案例
相关文章
  • 没有相关文章
相关评论
发表我的评论
  • 大名:
  • 内容:
本类固顶
  • 没有
  • FPGA/MATLAB商业/科研类项目合作(www.store718.com) © 2025 版权所有 All Rights Reserved.
  • Email:1480526168@qq.com 站长QQ: 1480526168