ofdm最终.zip

  • 阿木12
    了解作者
  • matlab
    开发工具
  • 6KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 2
    下载次数
  • 2021-04-27 10:19
    上传日期
OFDM(Orthogonal Frequency Division Multiplexing)即正交频分复用技术,实际上OFDM是MCM(Multi Carrier Modulation),多载波调制的一种。通过频分复用实现高速串行数据的并行传输, 它具有较好的抗多径衰弱的能力,能够支持多用户接入。 [1] OFDM技术由MCM(Multi-Carrier Modulation,多载波调制)发展而来。OFDM技术是多载波传输方案的实现方式之一,它的调制和解调是分别基于IFFT和FFT来实现的,是实现复杂度最低、应用最广的一种多载波传输方案。
ofdm最终.zip
  • ofdm最终
  • ofdm2.m
    1.6KB
  • iir3.m
    708B
  • ofdm.m
    3.7KB
  • fir1.m
    804B
  • untitled.fda
    2.3KB
  • fir2.m
    804B
内容介绍
%基本参数设定 clear ; close all; zaibo = 200; num1 = 100; f1 = 512; l1 = 128; l2 = 20; rate = []; SNR =20; num2 = 4; num3 = 1.5/32; % 串行二进制码元信号的产生 n1 = zaibo*num1*num2; Signal1 = round(rand(1,n1))'; % qam16调制 po1 = 29:228; po2 = 485:-1:286; Signal2 = qammod(Signal1,16,'InputType','bit'); figure(1); scatter(real(Signal2),imag(Signal2)); title('调制后的散点图'); grid on; % 串并转换 Signal3 = zeros(f1,num1); Signal2 = reshape(Signal2,zaibo,num1); figure(2); stem(abs(Signal2(:,1))); title("串并转换") grid on; % IFFT % 1-28置零 29-228有效 229-285置零 286-485共轭 486-512置零 Signal3(po1,:)=Signal2(:,:); Signal3(po2,:)=conj(Signal2(:,:)); signal4 = ifft(Signal3,f1); figure(3); plot(signal4(:,1),'b'); title('原始单个OFDM符号'); xlabel('Time'); ylabel('Amplitude'); %加循环前缀和后缀 signal_time_C = [signal4(end-l1+1:end,:);signal4]; signal_time_C = [signal_time_C; signal_time_C(1:l2,:)]; figure(4) plot(signal_time_C(:,1)); xlabel('Time'); ylabel('Amplitude'); title('加循环前缀后的单个OFDM符号'); %加窗 signal6 = signal_time_C.*repmat(jiachuang(num3,size(signal_time_C,1)),1,num1); figure(5) plot(signal6(:,1)) title('加窗后的单个OFDM符号') xlabel('Time'); ylabel('Amplitude'); %发送信号,多径信道 signal_Tx = reshape(signal6,1,[]); signal_origin = reshape(signal_time_C,1,[]); mult_path_am = [1 0.2 0.1]; % 多径幅度 mutt_path_time = [0 20 50]; % 多径时延 windowed_Tx = zeros(size(signal_Tx)); path2 = 0.2*[zeros(1,20) signal_Tx(1:end-20) ]; path3 = 0.1*[zeros(1,50) signal_Tx(1:end-50) ]; signal_Tx_mult = signal_Tx + path2 + path3; figure(6) subplot(2,1,1) plot(signal_Tx_mult) title('多径下OFDM信号') subplot(2,1,2) plot(signal_Tx) title('单径下OFDM信号') % 发送信号频谱 figure (7) n3 = 20*log10(mean(abs(fft(signal_time_C')))); subplot(2,1,1) plot((1:length(n3))/length(n3),n3)%归一化 hold on plot(0:1/length(n3):1 ,-35,'rd') hold off axis([0 1 -40 max(n3)]) grid on title('未加窗信号频谱') % 加窗信号频谱 n3 = 20*log10(mean(abs(fft(signal6')))); subplot(2,1,2) plot((1:length(n3))/length(n3),n3) hold on plot(0:1/length(n3):1 ,-35,'rd') hold off axis([0 1 -40 max(n3)]) grid on title('加窗信号频谱') % 加AWGN signal_power_sig = var(signal_Tx); % 单径发送信号功率 signal_power_mut = var(signal_Tx_mult); % 多径发送信号功率 SNR_linear = 10^(SNR/10); noise_power_mut = signal_power_mut/SNR_linear; noise_power_sig = signal_power_sig/SNR_linear; noise_sig = randn(size(signal_Tx))*sqrt(noise_power_sig); noise_mut = randn(size(signal_Tx_mult))*sqrt(noise_power_mut); % noise_sig=0; % noise_mut=0; Rx_data_sig = signal_Tx+noise_sig; Rx_data_mut = signal_Tx_mult+noise_mut; % 串并转换 Rx_data_mut = reshape(Rx_data_mut,f1+l2+l1,[]); Rx_data_sig = reshape(Rx_data_sig,f1+l2+l1,[]); %去循环前缀和后缀 Rx_data_sig(1:l1,:) = []; Rx_data_sig(end-l2+1:end,:) = []; Rx_data_mut(1:l1,:) = []; Rx_data_mut(end-l2+1:end,:) = []; % FFT fft_sig = fft(Rx_data_sig); fft_mut = fft(Rx_data_mut); data_sig = fft_sig(po1,:); data_mut = fft_mut(po1,:); figure(8) scatter(real(reshape(data_sig,1,[])),imag(reshape(data_sig,1,[])),'.') title("接收信号的星座图"); grid on; % 逆映射 n7 = reshape(qamdemod(data_sig,16,'OutputType','bit'),[],1); n8 = reshape(qamdemod(data_mut,16,'OutputType','bit'),[],1); % 误码率 error_bit_sig = sum(n7~=Signal1); error_bit_mut = sum(n8~=Signal1); error_rate_sig = error_bit_sig/n1; error_rate_mut = error_bit_mut/n1; rate = [rate; error_rate_sig error_rate_mut]; function window=jiachuang(a1,l1) warning off; window = zeros(1,l1/2); t = 1:l1/2; T = l1/(2*(1+a1)); window(t) = 0.5*(1 - sin(pi/(2*a1*T)*(t-T))); window(1:(1-a1)*T) = 1; window=[fliplr(window) window]'; end
评论
    相关推荐