Re: matlab code for multi-relay cooperative communication sy
hi guys is there any matlab code for multi relay networks ?
I have one to one relay to work...
now what do i need to do 2 make it multi relay ?
I need these program if anyone can help
thanks
---------- Post added at 20:04 ---------- Previous post was at 19:59 ----------
Hi again
this is matlab code for % Simulation 1: To demonstrate the effects of usingcover direct line of sight method on the transmission power required to provide a receiving power level of -30 dBm at the mobile station.
% function power
close all;
% Part 1: No-Relay Transmitted power
Pr = 10^-3; % Rx. power requirement of the M.S
dt = 2000; % Fixed distance from B.S to M.S
y=4; % Pathloss exponent in urban areas
Ptbm = Pr*(dt^y); % Calculate power transmitted in No relay system
PtbmdB = pow2dB(Ptbm) % Convert Milli Watts into dB
norelay=PtbmdB;
contnplot=0:1:2000; % For continuous graph
% Part 2: Relay Transmitted Power (Two-hop transmission)
dr = 0:50:2000 % distance at which RS is placed between BS & MS
for count1=1:41 % To calculate multiple values of Tx. Power
Ptb(count1)= (Pr*((dr(count1))^y)); % Calc. Tx Pwr from BS to RS
Ptr(count1)= (Pr*((dt-dr(count1))^y)); % Calc. Tx Pwr from RS to MS
Ptm(count1)=Ptb(count1)+ Ptr(count1); % Calc. total Tx Pwr
PtmdB(count1)= pow2dB(Ptm(count1)) % Convert Milli Watts into dB
Ptmin=min(PtmdB) % Find the minimum Tx. pwr
% find the distance at which minimum Tx. Pwr is achieved
if PtmdB(count1)== Ptmin
dmin = dr(count1);
end
end
% Part 3: Plot the graph
figure,
hold on % To plot the graph at the same plot
xlabel('Distance');
ylabel('Tx Power in dBm');
title('Tx. Power v/s distance')
xlim([0 2000]);
ylim([80 110]);
p1=plot(dr,PtmdB,'ro-'); % Plot the graph for Tx. Pwr in No Relay
p2=plot(contnplot,norelay); % Plot the graph for Tx. Pwr in Relay Tx.
p3=plot(dmin,Ptmin,'*'); % To plot the Min. Tx. Pwr in Relay Tx.
legend('Simple Relay', 'No Relay' , 'Optimum Power level');
hold off;
I hope it is helpful to all