How to calculate SNR for simulation in Matlab ?

I have the following Matlab code:
x=transpose(round(rand(1,n_bits)));
% Transmitter 1
k1=log2(M1);
EbNo1=10^(EbNodB1/10);
h1a=modem.qammod(M1);
h1a.inputtype='bit';
h1a.symbolorder='gray';
y1=modulate(h1a,x);
% Channel 1
Eb1=mean((abs(y1)).^2)/k1;
sigma1=sqrt(Eb1/(2*EbNo1));
w1=sigma1*(randn(n_bits/k1,1)+1i*randn(n_bits/k1,1)); % Noise
hf1=(1/sqrt(2))*(randn(n_bits/k1,1)+1i*randn(n_bits/k1,1)); %fading
r1=hf1.*y1;
r1a=r1+w1;
Can you tell me how to calculate the SNR after the signal go through the channel?? Thanks so much :)

Answers (0)

Categories

Asked:

on 2 Nov 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!