8X8 UnCoded 4-QAM using ZF

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% 8 X 8 Uncoded Mimo with ZF %%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear all;
close all;
N = 4*10^4;
M=4;
x = randi([0 3],1,N);
xmod=qammod(x,4);
xmod=reshape(xmod,8,N/8);
xmod=kron(xmod,[1,1,1,1,1,1,1,1]);
for i=1:64
    h(i,:)=1/sqrt(2)*(randn(1,N/8) + 1i*randn(1,N/8));
end
H=reshape(h,8,N);
y=reshape(sum(H.*xmod,1),8,N/8);
H=reshape(h,8,8,N/8);
snr=linspace(0,18,19);
ser=zeros(1,length(snr));
for ii=1:length(snr)
    N1=1/sqrt(2)*(randn(1,N)+1i*randn(1,N));
    N1=reshape(N1,8,N/8);
    ynoisy=y+10^(-(snr(ii)-10*log10(16))/20)*N1;
    %ynoisy=awgn(y,snr(ii),'measured');
    ynoisy=reshape(ynoisy,8,1,N/8);
    B=[];recvd=[];
    for kk=1:N/8
        Heq=transpose(H(:,:,kk));
        B=pinv(Heq);
        recvd=[recvd,B*ynoisy(:,:,kk)];
    end
    finy=qamdemod(reshape(recvd,1,N),4);
    [num ty]=symerr(x,finy);
    ser(ii)=ty;
end
semilogy(snr,ser,'r-*');
grid on;hold on;
title('Plot of Symbol error rate for Uncoded 8X8(4-QAM) System','FontSize',12);
legend('sim (nTx=8, nRx=8, Uncoded(4-QAM)) Using ZF','location','southwest');
xlabel('SNR(dB) ---->','Color','k','FontSize',11);Ylabel('Symbol Error rate ---->','Color','k','FontSize',11);