# SNR Calculation in a two hop relaying system

Status
Not open for further replies.

##### Newbie level 5 end to end snr

Dear All,

I hope you are all fine. I need your help as I am new to the digital communication field. I am simulating BER vs SNR for 2-hop(one relay between sourec and destination) relay system. I have confusion in plotting this relation. As is simple 1-hop system we define EBN0 at the transmitter side and the add awgn(varied according to the cahnge in EBN0) to the tranmitted signal. At the transmitter, we recover original signal and calculate no. of errors to calculate BER and then plot against the EBN0 that we defined at the transmission side.

Now my question that, should I follow the same procedure for a 2-hop system? How to calculate the SNR at the receiving end?(both at the relay and the destination)?. How to calculate the End-to-End SNR?

Please if anyone can help me in understanding this problem?. I cant find too much literature on m ulti-hop relay systems. I have studied amny papers on this topic but I can understand how to calculate the end to end SNR because all these papers plot BER vs End-to-End SNR.

Dear All,

I hope you are all fine. I need your help as I am new to the digital communication field. I am simulating BER vs SNR for 2-hop(one relay between sourec and destination) relay system. I have confusion in plotting this relation. As is simple 1-hop system we define EBN0 at the transmitter side and the add awgn(varied according to the cahnge in EBN0) to the tranmitted signal. At the receiver, we recover original signal and calculate no. of errors to calculate BER and then plot against the EBN0 that we defined at the transmission side.

Now my question that, should I follow the same procedure for a 2-hop system? How to calculate the SNR at the receiving end?(both at the relay and the destination)?. How to calculate the End-to-End SNR?

Please if anyone can help me in understanding this problem?. I cant find too much literature on m ulti-hop relay systems. I have studied amny papers on this topic but I can understand how to calculate the end to end SNR because all these papers plot BER vs End-to-End SNR.

##### Newbie level 5 calculate n0 awgn

Helloooo

Pls Pls PLssssssssssssssssssssssssssss

#### saeddawoud

##### Full Member level 3 snr calculation course

Hello,

I don't know if I can help you, but I will do my best. First of all, I will tell you how to compute the end-to-end SNR for Channel State Information (CSI)-assisted Amplify-and-Forward (AF) cooperative diversity system, at which the relay and the destination both have access to the instantaneous CSI.

Of course, you know that, in single-relay cooperative diversity systems, we have two branches, one from the Source $S$, and one from the Relay $R$ and these branches are combined at the Destination $D$. The two transmissions are asuumed to be orthogonal, either in frequency or in time. Let us take the time case. In the first time slot, the source $S$ broadcasts a symbol say $x$ with average transmitted power $P_S$ to both $R$ and $D$. In the second time slot, the relay $R$ amplifies the received signal from $S$, and re-transmits it to the destination $D$.

Assume that the fading coefficients are $\alpha_0$, $\alpha_1$, and $\alpha_2$ for the $S-D$, $S-R$, and $R-D$ links, respectively. Now mathematically:

$y_1=\alpha_1\,x+n_1$

is the received signal By $R$ from $S$.

$x_R=G\,y_1$

is the amplified signal at $R$, where $G$ is the amplification factor, which is in this case (CSI-assisted case) given by:

$G^2=\sqrt{\frac{P_R}{P_S\.|\alpha_0|^2+n_1}}$.

where $P_R$ is the average transmitted power by $R$. Now, the received signal at $D$ is

$y_2=\alpha_2\,x_R+n_2$

Now substitute for $x_R$ and find the Signal-to-Noise Ratio (SNR) of $y_2$ which gives you

$\frac{\gamma_1\,\gamma_2}{\gamma_1+\gamma_2+1}$

where $\gamma_i$ is the instantaneous SNR corresponding the channel coefficient $\alpha_i$ for $i=1,2$.

To plot $BER$ versus $SNR$, define a total power constriant for the system, say $P_{tot}$, where $P_S=\eta\,P_{tot}$ and $P_R=(1-\eta)\,P_{tot}$ where $0 < \eta \leq 1$, and assume that all noise powers are equal, say $N_0$, then write all SNRs in terms of $P_{tot}/N_0$, and use it to plot the BER.

That is all I can tell you.

Good luck

Last edited by a moderator:

##### Newbie level 5 Dear Saed,

thank you very much for the reply. I know theoretically all these equation you mentioned in your reply. I have problems in simulating the probelm. My problem is simple than yours. I am considering a system where the signal cant reach directly from transmitter to receiver and a relay is emplyed in between to relay the signal from the sopurce to destination. I am mentioning below that how I am simulating the problem. If you can suggest anything, I'll be thankful to you.

After generating a bit sequence, I defined EbN0 values (say [-10:2:10]). Now i used these values to calculate N0(for each value of EbN0) and added noise to the transmitted signal using N0. I calculated SNR for 1st hop using SNR_hop1 = 10*(log10((Es1*alpha1)/N0)). where Es1=signal power and i have taken it as 1 for simplicity and alpha1 is the fading amplitude of the channel between Tx and Relay, i have also taken it 1. Do you think that i am right upto this point?

Now to transmit the signal from relay to destination, what should i do? should i define EbN0 again? and should it be same as before for Tx to relay case?
I have confusion at this point. Please if you can help me here? i am writing the code here, please see it and suggest me if you know about the problem more

clear all;
close all;
clc;
N = 10^6; % number of bits or symbols
inp = randint(1,N);% generating 0,1 with equal probability
bpsk_sig = 2*inp-1; % BPSK modulation 0 -> -1; 1 -> 0
Es1 = 1;
Es2 = 1; % Energies of symbols
omega1 = 1; omega2 = 1; % Average fading power of 1st and second hop respectively
%**********************************************************************

%**********************************************************************
Eb_N0_db_1 = [-10:1.5:15]; % multiple Eb/N0 values

for i = 1:length(Eb_N0_db_1);

N0_1 = 10^(-1*(Eb_N0_db_1(i)/10));

SNR_hop1(i, = 10*(log10((Es1*omega1)/N0_1)) % N0 is used tocalculate SNR after 1st hop
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)]; % white gaussian noise,1db variance
y1 = bpsk_sig + N0_1*n;
end

%**************************************************************************
% At relay
%**************************************************************************
Eb_N0_db_2 = [-10:1.5:15]; % multiple Eb/N0 values

for i = 1:length(Eb_N0_db_2);

N0_2 = 10^(-1*(Eb_N0_db_2(i)/10));

SNR_hop2(i, = 10*(log10((Es2*omega2)/N0_2)) % N0 is used tocalculate SNR after 1st hop
n = 1/sqrt(2)*[randn(1,N) + j*randn(1,N)];
y2 = y1 + N0_2*n;

% counting the errors
end

%**************************************************************************
% End-to-End SNR
%**************************************************************************

E2E_SNR = (SNR_hop1.*SNR_hop2)./(SNR_hop1 + SNR_hop2+1)
Pb_Error = error/N;
figure(4)
semilogy(E2E_SNR,Pb_Error,'ro-','LineWidth',2);grid on;hold on;
% semilogy(SNR_hop2,Pb_Error,'go-','LineWidth',2);grid on;hold off;

#### saeddawoud

##### Full Member level 3 What is the relay operational mode: Amplify-and-Forward, or Decode-and-Forward? Then, regarding the code, I think you have to generate complex Gaussian RVs with zero-mean to represent the fading amplitudes as Rayleigh distributed RVs.

##### Newbie level 5 The relay mode is amply and forward. I am taking the fading amplitude as one and the gain also one to make the problem simple. i dont understand the transmission from relay to destination. should i define EbN0 values again? if yes, should it be same as for 1st hop?. Can you pls tell me the steps required for this simulation?

#### pa1

##### Newbie level 1 consider if iam sending BPSK modulated signal in rayleigh fading and AWGN channel
iam transmitting a signal that reciever knows about (pilot signal)
it recieves the signal

r= h.s+n0

now from that signal how can i calculate SNR and channel impulse response
pls help me

Status
Not open for further replies.