%program QASKclear all;clc;
%Transmitterjmlbit=100000;bitdata=randint(1,jmlbit,[0 1],1);map=reshape(bitdata,2,[]);x=map';for n=1:(jmlbit/2)if sum(x(n,:))==0;bit(:,n)=1;elseif x(n,1)<x(n,2);bit(:,n)=3;elseif x(n,1)>x(n,2);bit(:,n)=7;else sum(x(n,:))==1;bit(:,n)=5;endend
t=0:1/64:(1-1/64);b1=sqrt(2)*cos(2*pi*t);ask=b1'*bit;Qask=reshape(ask,1,[]);
%Receiverfor SNR=0:15;rqask=awgn(Qask,SNR,10*log10(64));tt=0:length(rqask)-1;tt=tt/64;r=reshape(rqask,64,[]);z=(b1*r/64);z1=round(z); %membulatkan nilai keatasfor n=1:(jmlbit/2);if z1(1,n)<2;bitrec(n,:)=[0 0];elseif z1(1,n)>2&&z1(1,n)<4;bitrec(n,:)=[0 1];elseif z1(1,n)>4&&z1(1,n)<6;bitrec(n,:)=[1 1];else z1(1,n)>6;bitrec(n,:)=[1 0];endenddataest=reshape(bitrec',1,[]);[N(1,SNR+1),BER(1,SNR+1)]=biterr(dataest,bitdata);end
SNR=0:15;figure(1)semilogy(SNR,BER);grid on;
Dan berikut hasil keluarannya :
Tidak ada komentar:
Posting Komentar