Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clc;
- clear all
- close all
- q = 16;
- nfig = 1;
- SNRdb = -6: 1: 12;
- C = zeros(1, length(SNRdb));
- for us = 1: length(SNRdb)
- SNR = 10^(SNRdb(us)/10); %вычисляем отношение сигнал шум
- Pp = zeros(q, q);
- fun = @(alpha) ((1 - qfunc(alpha)).^(q-1))*(1/sqrt(2*pi)).*exp((-(alpha-sqrt(2*SNR)).^2)/2);
- Pe = 1 - integral(fun, -inf, inf);
- for i=1:q
- for l=1:q
- if(l==i)
- Pp(i, l) = 1 - Pe;
- else
- Pp(i, l) = Pe / (q - 1);
- end
- end
- end
- for i=1:q
- for l=1:q
- C(us) = C(us) + (Pp(i, l)*(1/q))*log2((Pp(i, l)*(1/q))/((1/q)*PY(l)));
- end
- end
- end
- figure(nfig);
- plot(SNRdb, C,'b')
- grid on;
- xlabel('SNR, dB');
- ylabel('C, bps');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement