Home » Source Code » LS MMSE ofdm channel estimation » OFDM_CE_LS_MMSE_v3.m

OFDM_CE_LS_MMSE_v3.m ( File view )

  • By m.gh 2015-01-30
  • View(s):17
  • Download(s):0
  • Point(s): 1
			%% OFDM system with channel estimation:
clear all; close all; clc;
global W
%% define parameters 

T=2;
R=2;
m=100%input( ' how many OFDM symbols to be simulated m = ' ) ;
N=64%input( ' length of OFDM symbols N = ' ) ;
M=16%input( ' Constellation Order M = ' ) ; 
pilotFrequency=4%input('Pilot Frequency = ' ) ;
E=1%input('Pilot Energy = ');
Ncp=8%input( ' Cyclic Prefix length = ' ) ;
L=2%input(' channel Length (number of taps) = ');
typ=1%input('Constellation Family Type is [1 for M-QAM, 2 for M-PSK]:- ');
%% ----------------------------------------------------------------------
%% define the modems Tx/Rx
switch typ
    case 1
        Tx=modem.qammod('M',M);
        Rx=modem.qamdemod ('M',M);
    case 2
        Tx=modem.pskmod('M',M);
        Rx=modem.pskdemod ('M',M);
    otherwise
        error('Error, Constellation Family not Defined');
end

 
%% data generation 
D=randi ([0 M-1],m,N);
%% mapping (baseband modulation )
D_Mod=modulate(Tx,D);
%% serial to parallel 
D_Mod_serial=D_Mod.';
%% specify Pilot & Date Locations
PLoc = 1:pilotFrequency:N % location of pilots
DLoc = setxor(1:N,PLoc) % location of data
%% Pilot Insertion
D_Mod_serial(PLoc,:)=E*D_Mod_serial(PLoc,:);
 figure;
%imagesc(abs(D_Mod_serial ))
%% inverse discret Fourier transform (IFFT)
%  Amplitude Modulation
d_ifft=ifft(D_Mod_serial);
%%  serail to parallel 
d_ifft_parallel=d_ifft.';
%% Adding Cyclic Prefix
CP_part=d_ifft_parallel(:,end-Ncp+1:end); % this is the Cyclic Prefix part to be appended.
ofdm_cp=[CP_part d_ifft_parallel];
%% generating random channel 
h= randn(1,L) + 1j * randn(1,L);
NORM=norm(h);
h = h./norm(h); % normalization 
H = fft(h,N); % Frequency-Domain Channel 
d_channelled = filter(h,1,ofdm_cp.').'; % channel effect
channel_length = length(h); % True channel and its time-domain length
H_power_dB = 10*log10(abs(H.*conj(H))); % True channel power in dB
%% add noise 
count=0
snr_vector=0:4:40     %%%%%%(??? 11 ??? ???? ???? ????? ????)
for snr=snr_vector
    SNR = snr + 10*log10(log2(M));
    count=count+1; 
    disp(['step: ',num2str(count),' of: ',num2str(length(snr_vector))]);
    ofdm_noisy_NoCH=awgn(ofdm_cp,SNR,'measured' ); 
    ofdm_noisy_with_chann=awgn(d_channelled,SNR,'measured' ); 
    %% receiver
    %Remove Cyclic Prefix
    ofdm_cp_removed_NoCH=ofdm_noisy_NoCH(:,Ncp+1:N+Ncp);
    ofdm_cp_removed_with_chann=ofdm_noisy_with_chann(:,Ncp+1:N+Ncp);
    % serial to parallel 
    ofdm_parallel_NoCH=ofdm_cp_removed_NoCH.';
    ofdm_parallel_chann=ofdm_cp_removed_with_chann.';
    %% Discret Fourier transform (FFT)
    %  Amplitude Demodulation
    d_parallel_fft_NoCH=fft(ofdm_parallel_NoCH) ;
    d_parallel_fft_channel=fft(ofdm_parallel_chann) ;


    %% channel estimation
    % Extracting received pilots
    TxP = D_Mod_serial(PLoc,:); % trnasmitted pilots
    RxP = d_parallel_fft_channel(PLoc,:); % received pilots
    % Least-Square Estimation
    Hpilot_LS= RxP./TxP; % LS channel estimation
    % MMSE Estimation:- 
    for r=1:m
        H_MMSE(:,r) = MMSE(RxP(:,r),TxP(:,r),N,pilotFrequency,h,SNR);
    end

    % Interpolation p--->N    
    for q=1:m
    HData_LS(:,q) = interpolate(Hpilot_LS(:,q).',PLoc,N,'spline'); % Linear/Spline interpolation
    end
    %% parallel to serial   
    HData_LS_parallel1=HData_LS.';
    HData_MMSE_parallel1=H_MMSE.';


    %% demapping 
    d_received
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
interpolate.m938.00 B04-06-14|15:13
MMSE.m1,020.00 B04-06-14|15:13
interpolate.m938.00 B04-06-14|15:13
OFDM_CE_LS_MMSE_v311.m9.33 kB02-01-15|09:43
Untitled.m7.89 kB21-01-15|01:00
OFDM_CE_LS_MMSE_v3.m5.04 kB23-01-15|21:17
New0.00 B0%|21-01-15
Channel0.00 B0|0
...
Sponsored links

OFDM_CE_LS_MMSE_v3.m (8.86 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D