About this blog

I have created this blog with the intention of blogging on my academic interests. But you can't really hold me to that. I might post on anything that interests me.

Most of the posts, I guess, would be on problems that I find interesting. A majority of them would be from from Linear Algebra, probability, basic geometry, Communications, Signal Processing and Machine Learning; Some stuff might be from my previous love, Classical Physics.

So where do I get these problems/ articles/posts from? Do I think of them? Are they my original ideas? The answer to all such questions is a plain and simple No. I shamelessly copy stuff from the outside world and post them here as if they were my own (who doesn't?). This doesn't mean that all of the stuff that is here is stolen. I do intend blogging a fair deal on my research, which, by definition, is original. I also intend blogging on open problems on areas that I am conversant with, and the ones that I understand fairly well. Definitely, most of the problems would have solutions that are my own or thought process that is my own. But again, you can't really hold me to that either. :-)

Before finishing this write-up, there's something you probably need to know. Avoid using offensive language while you are here. I will just delete them the instant I see them. I don't care if the rest of the sentence contains the answer to why the Universe was created in the first place. I will simply delete it.

Hope you like my blog.

Showing posts with label Cyclic prefix. Show all posts
Showing posts with label Cyclic prefix. Show all posts

Tuesday, 3 April 2012

COMPARISON OF DIFFERENT CHANNEL ESTIMATION TECHNIQUES FOR CP-OFDM SYSTEMS OPERATING IN A MULTIPATH RAYLEIGH FADING CHANNEL WITH EXPONENTIAL POWER DELAY PROFILE


SYSTEM SPECIFICATIONS:

   1)  128 Subcarriers used
   2)  Guard tones in first 8 and last 7 subcarriers to keep check on adjacent channel interference
   3)  DC guard at subcarrier 64 to keep check on PAPR
   4)  8 tap Rayleigh fading channel with exponential PDP
   5)  Cyclic prefix length of 16
   6)  BPSK modulation
   7)  Pilot spacing of 4 subcarriers


MATLAB CODE:

clc;
clear all;
close all;

for j=1:8
    wf(1,j)=(1)./exp(j-1);          %FOR EXPONENTIAL PDP
end

a=1;                                %BPSK MODULATION OF FIXED POWER
N=128;                              %NUMBER OF SUB-CARRIERS

SNRstart=-10;
SNRend=30;                          %DEFINITION OF SNR RANGE OVER WHICH WE SIMULATE
snr=SNRstart:SNRend;

for SNR=SNRstart:SNRend
    for chnlno=1:power(10,2)        %TIME VARYING CHANNEL FOR EVERY SNR
       
        databits=rand(1,128);       %DATA BITS
        
        for i=1:length(databits)
            if databits(i)<0.5
                sym(i)=a;
            else                    %MAPPING BITS TO BPSK CONSTELLATION
                sym(i)=-a;
            end
        end
       
        for i=1:8
            sym(i)=0;               %GUARD TONES
        end
       
        for i=121:128
            sym(i)=0;               %GUARD TONES
        end
       
        for i=9:4:117
            sym(i)=a;               %PILOTS WITH SPACING OF 4 SUBCARRIERS
        end
       
        sym(64)=0;                  %DC GUARD
       
        pilotvector=a*ones(1,28);
        X=diag(pilotvector);        %REPRESENTING PILOT IN MATRIX FORM FOR EQUALIZATION ALGORITHMS
       
        %SYMBOL SEQUENCE GENERATED WITH GUARD TONES AND PILOTS
       
        xi=ifft(sym,128);
        for i=113:128
            cp(i-112)=xi(i);
        end
        x=horzcat(cp,xi);
       
        %INSERTED CP. READY FOR TRANSMISSION
       
        hi=((1/sqrt(2))*randn(8,2));  %1/sqrt(2) to make variance of each dimension 1/2
        for j=1:length(hi)
            hi2(1,j)=hi(j,1)+sqrt(-1)*hi(j,2);
        end
        h=(wf).*(hi2);
       
        %FREQ. SELECTIVE RAYLEIGH FADING CHANNEL GENERATED WITH EXPONENTIAL PDP
       
        chf=fft(h,128);
        chfp=chf(9:4:117);              %CHANNEL FREQUENCY RESPONSE AT PILOT LOCATIONS
       
        ynn=conv(x,h);
        ynnc=cconv(xi,h,128);
       
        sigma=(1)/(sqrt(2*(power(10,(SNR/10)))));
        noisei=(sigma)*randn(length(ynn),2);
        for j=1:length(ynn)
            noise(1,j)=noisei(j,1)+sqrt(-1)*noisei(j,2);
        end
        y=ynn+noise;
                     
        %SIGNAL TRANSMITTED THRU RAYLEIGH AWGN CHANNEL
       
        for i=17:144
            yhi(i-16)=y(i);
        end
       
        %CP REMOVED
       
        yh=fft(yhi);
       
        %DATA DEMODULATED
       
        flag=0;
        for i=9:4:117
            flag=flag+1;
            Yp(flag,1)=yh(i);
        end
       
        %DATA EXTRACTED FROM PILOT TONES
       
        D=diag(a*ones(flag,1));
        cefpi=(D')*(Yp);        %  ' STANDS FOR HERMITION. THIS CASE, D and D' ARE JUST IDENTITY MATRICES. (a=1)
        cet=ifft(cefpi);
               
        for i=17:length(cet)
            cet(i)=0;               % REMOVING NOISE SINCE WE KNOW THAT CP LENGTH IS ONLY 16
        end
        cefproc=fft(cet,28);        % DFT BASED LS ESTIMATE
       
        %TIME DOMAIN PROCESSING DONE TO SUPPRESS NOISE
              
        Fmi=dftmtx(128);
        flag=0;
        for i=9:4:117
            flag=flag+1;
            Fmi2(flag,:)=Fmi(i,:);
        end
        nullingmatrx=zeros(128,8);
        for i=1:8
            nullingmatrx(i,i)=1;
        end
        Fm=Fmi2*nullingmatrx;                        %Modified DFT Matrix for MMSE equalizer
       
        Hcapfdls(:,chnlno)=X\Yp;       %Freq. domain LS. Same as Yp since X is identity for our choice of pilot
        Hcapmmse(:,chnlno)=pinv(Fm)*Yp;              %MMSE estimate.
        Hcapdftmmse(:,chnlno)=pinv(Fm)*cefproc;      %DFT Based MMSE.
       
                    
        MSEi(chnlno)=(1/length(chfp))*(sum(power((abs(cefproc-transpose(chfp))),2)));
        MSEfdlsi(chnlno)=(1/length(chfp))*(sum(power((abs(Hcapfdls(:,chnlno)-transpose(chfp))),2)));
        MSEmmsei(chnlno)=(1/length(h))*(sum(power((abs(Hcapmmse(:,chnlno)-transpose(h))),2)));
        MSEdftmmsei(chnlno)=(1/length(h))*(sum(power((abs(Hcapdftmmse(:,chnlno)-transpose(h))),2)));
    end
   
    MSE(SNR-SNRstart+1)=(1/chnlno)*sum(MSEi);   
    MSEfdls(SNR-SNRstart+1)=(1/chnlno)*sum(MSEfdlsi);   
    MSEmmse(SNR-SNRstart+1)=(1/chnlno)*sum(MSEmmsei);   
    MSEdftmmse(SNR-SNRstart+1)=(1/chnlno)*sum(MSEdftmmsei);   
end

figure(1);
semilogy(snr,MSEfdls,snr,MSE,snr,MSEmmse,snr,MSEdftmmse,'linewidth',1.5);
legend('LEAST SQUARES','DFT BASED LEAST SQUARES','MMSE','DFT BASED MMSE');
xlim([-5 30]);
xlabel('SNR IN dB ------>');
ylabel('MEAN SQUARE ERROR');
title('COMPARISON OF DIFFERENT CHANNEL ESTIMATION TECHNIQUES FOR CP-OFDM SYSTEMS');
grid;


MSE PLOTS:



SOME PHILOSOPHY:

   1)  Transmitting RF amplifier limits PAPR of the transmitted signal. The RF industry has caught up with this problem. Nevertheless, from power efficiency point of view, it makes sense to restrict the PAPR. The power amplifiers, even today, are only about 50%-60% power efficient. An easy way of limiting PAPR is to use a DC guard.

        2)       DFT based MMSE and DFT based LS perform better than MMSE alone and LS alone, respectively. This is expected since we suppress noise in DFT based estimates by exploiting the knowledge of channel impulse response length.


QUESTIONS:

   1)  I am not sure if DFT based LS will perform better than MMSE. My results say otherwise. Does anybody know for sure that MMSE performs better than DFT based LS? Any published reference that compares DFT based LS and MMSE? 

BIT ERROR RATE OF COHERENT CP-OFDM SYSTEM OPERATING OVER A RAYLEIGH FADING CHANNEL


SYSTEM SPECIFICATIONS:

1) 128 subcarriers
  BPSK modulation
3)  10 tap Rayleigh fading channel with exponential PDP
4)  Cyclic prefix length of 32 to avoid Inter-block interference
5)  Coherent receiver


MATLAB CODE:

clc;
clear all;
close all;
k=0;
snr= -5:2:11;
snrn=power(10,snr/10);
a=1;

for j=1:20
    wf(1,j)=1./exp(j-1);                   %EXPONENTIAL POWER DELAY PROFILE
end

for SNR=-5:2:11
    k=k+1;
    error=0;
    for chnlno=1:power(10,3)
        msgbits=randint(1,128);                           % 128 SUBCARRIERS
        for i=1:length(msgbits)
            if msgbits(i)==0
                s(i)=a;
            else
                s(i)=-a;
            end
        end                                              %BPSK MAPPING DONE
       
        xi=ifft(s);
        for i=97:128
            cp(i-96)=xi(i);                                  % 32 LENGTH CP
        end
        x=horzcat(cp,xi);                              %CYCLIC PREFIX ADDED
       
        hi=((1/sqrt(2))*randn(20,2));
        for j=1:20
            hi2(1,j)=hi(j,1)+sqrt(-1)*hi(j,2);             % 10 TAP CHANNEL
        end
        h=(wf).*(hi2);
       
        ynn=conv(x,h);     
       
        sigmasqr=(1)/(2*(power(10,(SNR/10))));
        noisei=(sigmasqr)*randn(length(ynn),2);
       
        for j=1:length(ynn)
            noise(1,j)=noisei(j,1)+sqrt(-1)*noisei(j,2);
        end
       
        y=ynn+noise;
       
        for i=33:160
            yh(i-32)=y(i);                           %CYCLIC PREFIX REMOVED
        end
       
        Yeq=(fft(yh))./(fft(h,128));
        yeq=ifft(Yeq);
        yi=fft(yeq);
       
        for i=1:128
            if real(yi(i)>0)
                mh(i)=0;
            else
                mh(i)=1;
            end
        end
       
        for i=1:128
            if mh(i)==msgbits(i)
                error=error+0;
            else
                error=error+1;
            end
        end
    end
    BER(k)=error/(128*power(10,4));
end
figure(1);
semilogy(snr,BER,'linewidth',1.5);
xlabel('SNR IN dB ------>');
ylabel('BER');
title('BER PERFORMANCE OF A CP-OFDM SYSTEM');
grid;

SNR Vs BER CURVE:

SOME PHILOSOPHY:

1)  BER curve almost in sync with that of a single carrier system operating over Rayleigh flat fading channel (as expected).

2)  Do not expect waterfall curve for BER in Rayleigh fading channels. BER plot will always be a straight line in high SNR regime. Slope can be improved using diversity (time, frequency, space).

3)  To make OFDM achieve frequency diversity, you have to code across subcarriers instead of coding across time. Coding across time alone results in high latency since OFDM symbol duration is pretty high. Typical systems code across both subcarriers and time in order to achieve same diversity with lesser latency (as compared to coding just across time).

4)  While coding across subcarriers, keep in mind that not all parallel channels are uncorrelated. You need to determine the minimum frequency spacing for uncorrelatedness before you code. Otherwise, you will not get full diversity.