Path: news.mathworks.com!not-for-mail
From: "mahmud_dbm " <mahmud_dbm@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: problem with mimochan
Date: Fri, 20 Nov 2009 01:54:01 +0000 (UTC)
Organization: KIIT University
Lines: 203
Message-ID: <he4srp$s4j$1@fred.mathworks.com>
References: <h7sf0m$4t8$1@fred.mathworks.com>
Reply-To: "mahmud_dbm " <mahmud_dbm@yahoo.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1258682041 28819 172.30.248.37 (20 Nov 2009 01:54:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 20 Nov 2009 01:54:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2094028
Xref: news.mathworks.com comp.soft-sys.matlab:586606

Hello Dear Makram...

a checked your problem, it is absolutely okay... only if you don't use the 'measured'
value of SNR i.e awgn(r1by1, EbNo(idx),'Measured');

simply use awgn(r1by1, EbNo(idx)) .... i think this helps.

anyway i'm missing some basic idea here like..

1. Least Square Channel Estimation. how did you calculate that for higher order scheme (e.g 2x2 or more) and if my system dose not use any pilot technique, what'd i do then.?? let me know weather you got me or nt..?

thanks ..
mahmud

-----------------------------------------------------------------------------------------------------






"Makram " <alkhalid_1985@yahoo.com> wrote in message <h7sf0m$4t8$1@fred.mathworks.com>...
> Hi everybody,
> 
>  I am trying to do a comparison between SISO, MISO, SIMO, and MIMO systems by using the object mimochan with different configuration for each system and with channel estimation at the receiver. My problem is that I am getting a wrong results,the result (graph) shows that SISO system is better than the MISO system, and the SIMO system is better than the MIMO system, I have tried so hard to know what is the problem but I couldn't. any suggestion will be more than welcome, here is my code:
> 
> 
> clc;
> clear;
> frmLen = 192;           % frame length
> maxNumPackets = 100;    % maximum number of packets
> EbNo = 0:2:14;          % Eb/No varying to 12 dB
> N = 2;                  % number of Tx antennas
> M = 2;                  % number of Rx antennas
> pLen = 8;               % number of pilot symbols per frame
> W = hadamard(pLen);
> pilots1 = W(:, 1);      
> pilots2 = W(:, 1:N);    % orthogonal set per transmit antenna
> h = gcf;
> P = 4;                  % Modulation Order
> T = 0.0000001;          % Sample Time for Bandwidth = 5 MHz
> FD= 100;                % Doppler Shift
> 
> % Create BPSK mod-demod objects
> bpskmod = modem.pskmod('M', P, 'SymbolOrder', 'Gray');
> bpskdemod = modem.pskdemod(bpskmod);
> 
> % Pre-allocate variables for speed
> tx1=zeros(frmLen,1) ; s1=zeros(frmLen/2,1) ; s2=s1 ; tx2=zeros(frmLen,2);
> trans1=zeros(pLen+frmLen,1) ; trans2=zeros(pLen+frmLen,2) ; 
> r1by1=zeros(pLen+frmLen,1) ; r1by1_noisy=r1by1 ; H1by1=zeros(frmLen,1);
> r1by2=zeros(pLen+frmLen,2) ; r1by2_noisy=r1by2 ; H1by2=zeros(frmLen,2); z12=zeros(frmLen,2) ; z12_2=zeros(frmLen,1);
> r2by1=zeros(pLen+frmLen,1) ; r2by1_noisy=r2by1 ; H2by1=zeros(frmLen,2); z21_1=zeros(frmLen/2,1) ; z21_2=z21_1 ; z21=zeros(frmLen,1);
> r2by2=zeros(pLen+frmLen,2) ; r2by2_noisy=r2by2 ; H2by2=zeros(frmLen,2,2); z22_1=zeros(frmLen/2,2) ; z22_2=z22_1 ; z22=zeros(frmLen,2);
> BER1by1=zeros(1,length(EbNo)); BER2by1 = BER1by1 ; BER1by2 = BER1by1 ; BER2by2 = BER1by1;
> 
> % Set up a figure for visualizing BEr results
> clf(h);
> grid on;
> hold on;
> set(gca,'yscale','log','xlim',[EbNo(1)-1 , EbNo(end)+1],'ylim',[1e-7 1]);
> xlabel('Eb/No (dB)');
> ylabel('BEr'); 
> set(h,'NumberTitle','off');
> set(h,'Name','Orthogonal Space-Time Block Coding');
> set(h, 'renderer', 'zbuffer');  title('Comparision between the diffirent systems');
> 
> % Loop over several EbNo points
> for idx = 1:length(EbNo)
>     SNR = EbNo(idx)
>     
>     % Loop over the number of packets
>     for packetIdx = 1:maxNumPackets
>         data = randint(frmLen, 1, P);  % Generating Random Data (0 or 1)
>         bpskmod = modem.pskmod('M', P, 'SymbolOrder', 'Gray');      
>         tx1 = modulate(bpskmod, data);      % BPSK modulation
>         
>         % Alamouti Encoder, G2
>         %   X = [s1 s2; -s2* s1*]
>         s1 = tx1(1:N:end); s2 = tx1(2:N:end);
>         tx2(1:2:end, :) = [s1 s2];
>         tx2(2:2:end, :) = [-conj(s2) conj(s1)];
> 
>         % Prepend pilot symbols for each frame
>         trans1 = [pilots1; tx1];
>         trans2 = [pilots2; tx2];
>               
>         % For SISO System (1x1):
>         chan1by1 = mimochan (1,1,T,FD);
>         r1by1 = filter(chan1by1, trans1);
>         r1by1_noisy = awgn(r1by1, EbNo(idx),'Measured');
>         
>         % Channel Estimation
>         H1by1(1, 1) = (r1by1_noisy(1:pLen,1).' * pilots1(:, 1))./pLen;   %  Least Square Channel Estimation
>         
>         % assume held constant for the whole frame
>         H1by1 = H1by1(ones(frmLen, 1),1);
>         
>         % Determine errors
>         demod1by1 = demodulate(bpskdemod, (r1by1_noisy(pLen+1:end,:).*conj(H1by1)));
>         error1by1(packetIdx) = biterr(demod1by1, data);
>         
>         % For SIMO System (1x2):
>         chan1by2 = mimochan (1,2,T,FD);
>         r1by2 = filter (chan1by2, trans1);
>         r1by2_noisy = awgn(r1by2,EbNo(idx),'Measured');
>         
>         % Channel Estimation
>         for n = 1:2
>             H1by2(1, n) = (r1by2_noisy(1:pLen, n).' * pilots1(:, :))./pLen;   %  Least Square Channel Estimation
>         end
>         
>         % assume held constant for the whole frame
>         H1by2 = H1by2(ones(frmLen, 1),:);
>      
>         % Determine Errrors
>         z12=r1by2_noisy((pLen+1:end),:).* conj(H1by2);
>         z12_2= sum(z12,2);
>         demod1by2 = demodulate(bpskdemod,z12_2);
>         error1by2(packetIdx) = biterr(demod1by2, data);
>         
>         % For MISO System (2x1):
>         chan2by1 = mimochan (2,1,T,FD);
>         r2by1 = filter (chan2by1 , (trans2./sqrt(2)));
>         r2by1_noisy = awgn(r2by1,EbNo(idx),'Measured');
>         
>         % Channel Estimation
>         for n = 1:2
>             H2by1(1, n) = (r2by1_noisy(1:pLen, :).' * pilots2(:, n))./pLen;   %  Least Square Channel Estimation
>         end
>         
>         %   assume held constant for the whole frame
>         H2by1 = H2by1(ones(frmLen, 1), :);
>         
>         hidx = 1:2:length(H2by1);
>         z21_1 = r2by1_noisy(pLen+1:2:end).*conj(H2by1(hidx,1))+ ....
>             conj(r2by1_noisy(pLen+2:2:end)).*H2by1(hidx,2);
>         z21_2 = r2by1_noisy(pLen+1:2:end).*conj(H2by1(hidx,2))- ....
>             conj(r2by1(pLen+2:2:end)).*H2by1(hidx,1);
>         z21(1:2:end)= z21_1; 
>         z21(2:2:end) = z21_2;
>         
>         % Determine Errors
>         demod2by1 = demodulate(bpskdemod, z21);
>         error2by1 (packetIdx) = biterr(demod2by1, data);
>         
>         %   For MIMO System (2x2)
>         chan2by2 = mimochan (2,2,T,FD);
>         r2by2 = filter (chan2by2 , (trans2./sqrt(2)));
>         r2by2_noisy = awgn(r2by2,EbNo(idx),'Measured');
>        
>         % Channel Estimation
>         for n = 1:2
>             H2by2(1, n, :) = (r2by2_noisy(1:pLen, :).' * pilots2(:, n))./pLen;   %  Least Square Channel Estimation
>         end
>         
>         % assume held constant for the whole frame
>         H2by2 = H2by2(ones(frmLen, 1), :, :);
>         
>         % Combiner using estimated channel
>         heidx = 1:2:length(H2by2);
>         for i = 1:2
>              z22_1(:, i) = r2by2_noisy(pLen+1:2:end, i).* conj(H2by2(heidx, 1, i)) + ...
>                          conj(r2by2_noisy(pLen+2:2:end, i)).* H2by2(heidx, 2, i);
> 
>              z22_2(:, i) = r2by2_noisy(pLen+1:2:end, i).* conj(H2by2(heidx, 2, i)) - ...
>                          conj(r2by2_noisy(pLen+2:N:end, i)).* H2by2(heidx, 1, i);
>         end
>         z22(1:2:end, :) = z22_1  ; z22(2:2:end, :) = z22_2;
>         
>         %   Detemine Errors
>         demod2by2   = demodulate(bpskdemod, sum(z22, 2));   
>         error2by2(packetIdx) = biterr(demod2by2, data);
>     
>     end
>     
>     % Calculate BER for current idx
>     BER1by1(idx) = sum(error1by1)/(maxNumPackets*frmLen);
>     BER1x1 = BER1by1(idx)
>     
>     BER1by2(idx) = sum(error1by2)/(maxNumPackets*frmLen);
>     BER1x2 = BER1by2(idx)
>     
>     BER2by1(idx) = sum(error2by1)/(maxNumPackets*frmLen);
>     BER2x1 = BER2by1(idx)
> 
>     BER2by2(idx) = sum(error2by2)/(maxNumPackets*frmLen);
>     BER2x2 = BER2by2(idx)
>         
>     % Plot the results
>     semilogy(EbNo(1:idx), BER1by1(1:idx), 'r*');
>    % drawnow;
>     semilogy(EbNo(1:idx), BER2by1(1:idx), 'go');
>     %drawnow; 
>     semilogy(EbNo(1:idx), BER1by2(1:idx), 'b+');
>     %drawnow;
>     semilogy(EbNo(1:idx), BER2by2(1:idx), 'm>');
>     legend('SISO System (1Tx, 1Rx)','MISO System (2Tx, 1Rx)','SIMO System (1Tx, 2Rx)','MIMO System (2Tx,2Rx)');
>     drawnow;
> end  % end of for loop for EbNo
>         
>     semilogy(EbNo,BER1by1,'r', EbNo,BER2by1,'g', EbNo,BER1by2,'b', EbNo,BER2by2,'m');
>     hold off;