├── simulateFigure2.m ├── readme.md ├── simulateFigure5.m └── simulateFigure4.m /simulateFigure2.m: -------------------------------------------------------------------------------- 1 | %%This Matlab script generates Figure 2 in the paper: 2 | % 3 | %Emil Björnson, Özgecan Özdogan, Erik G. Larsson, “Intelligent Reflecting 4 | %Surface vs. Decode-and-Forward: How Large Surfaces Are Needed to Beat 5 | %Relaying?,” IEEE Wireless Communications Letters, To appear 6 | % 7 | %Download article: https://arxiv.org/pdf/1906.03949 8 | % 9 | %This is version 1.1 (Last edited: 2021-12-23) 10 | % 11 | %License: This code is licensed under the GPLv2 license. If you in any way 12 | %use this code for research that results in publications, please cite our 13 | %paper as described above. 14 | 15 | 16 | close all; 17 | clear; 18 | 19 | %% Set parameter values 20 | 21 | %Carrier frequency (in GHz) 22 | fc = 3; 23 | 24 | %Distances in m 25 | d = 10:0.1:100; 26 | 27 | %Define the antenna gains at the transmitter and receiver 28 | antennaGainTdBi = 5; 29 | antennaGainRdBi = 5; 30 | 31 | %Compute channel gains based on the 3GPP Urban Micro in "Further 32 | %advancements for E-UTRA physical layer aspects (Release 9)." 33 | %3GPP TS 36.814, Mar. 2010. Note that the antenna gains are included. 34 | beta_3GPP_LOS = db2pow(antennaGainTdBi+antennaGainRdBi-28-20*log10(fc)-22*log10(d)); 35 | beta_3GPP_NLOS = db2pow(antennaGainTdBi+antennaGainRdBi-22.7-26*log10(fc)-36.7*log10(d)); 36 | 37 | 38 | 39 | %% Plot simulation results 40 | 41 | figure; 42 | hold on; box on; grid on; 43 | plot(d,10*log10(beta_3GPP_LOS),'k-.','LineWidth',2); 44 | plot(d,10*log10(beta_3GPP_NLOS),'r--','LineWidth',2); 45 | xlabel('Distance $d$ [m]','Interpreter','Latex'); 46 | ylabel('Channel gain $\beta(d)$ [dB]','Interpreter','Latex'); 47 | legend({'UMi-LOS','UMi-NLOS'},'Interpreter','Latex'); 48 | set(gca,'fontsize',18); 49 | ylim([-110 -50]); 50 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Intelligent Reflecting Surface vs. Decode-and-Forward: How Large Surfaces Are Needed to Beat Relaying? 2 | ================== 3 | 4 | This is a code package is related to the follow scientific article: 5 | 6 | Emil Björnson, Özgecan Özdogan, Erik G. Larsson, “[Intelligent Reflecting Surface vs. Decode-and-Forward: How Large Surfaces Are Needed to Beat Relaying?](https://arxiv.org/pdf/1906.03949),” IEEE Wireless Communications Letters, vol. 9, no. 2, pp. 244-248, February 2020. 7 | 8 | The package contains a simulation environment, based on Matlab, that reproduces some of the numerical results and figures in the article. *We encourage you to also perform reproducible research!* 9 | 10 | 11 | ## Abstract of Article 12 | 13 | The rate and energy efficiency of wireless channels can be improved by deploying software-controlled metasurfaces to reflect signals from the source to destination, especially when the direct path is weak. While previous works mainly optimized the reflections, this letter compares the new technology with classic decode-and-forward (DF) relaying. The main observation is that very high rates and/or large metasurfaces are needed to outperform DF relaying, both in terms of minimizing the total transmit power and maximizing the energy efficiency, which also includes the dissipation in the transceiver hardware. 14 | 15 | 16 | ## Content of Code Package 17 | 18 | The article contains 3 simulation figures, numbered 2, 4 and 5. simulationFigure2.m generates Figure 2, simulationFigure4.m generates Figures 4(a) and 4(b), and simulationFigure5.m generates Figure 5. 19 | 20 | See each file for further documentation. 21 | 22 | 23 | ## Acknowledgements 24 | 25 | The paper was supported by ELLIIT and the Swedish Research Council 26 | 27 | 28 | ## License and Referencing 29 | 30 | This code package is licensed under the GPLv2 license. If you in any way use this code for research that results in publications, please cite our original article listed above. 31 | -------------------------------------------------------------------------------- /simulateFigure5.m: -------------------------------------------------------------------------------- 1 | %%This Matlab script generates Figure 5 in the paper: 2 | % 3 | %Emil Björnson, Özgecan Özdogan, Erik G. Larsson, “Intelligent Reflecting 4 | %Surface vs. Decode-and-Forward: How Large Surfaces Are Needed to Beat 5 | %Relaying?,” IEEE Wireless Communications Letters, To appear 6 | % 7 | %Download article: https://arxiv.org/pdf/1906.03949 8 | % 9 | %This is version 1.1 (Last edited: 2024-07-25) 10 | % 11 | %License: This code is licensed under the GPLv2 license. If you in any way 12 | %use this code for research that results in publications, please cite our 13 | %paper as described above. 14 | 15 | 16 | close all; 17 | clear; 18 | 19 | 20 | %% Set simulation parameters 21 | 22 | %Carrier frequency (in GHz) 23 | fc = 3; 24 | 25 | %Bandwidth 26 | B = 10e6; 27 | 28 | %Noise figure (in dB) 29 | noiseFiguredB = 10; 30 | 31 | %Compute the noise power in dBm 32 | sigma2dBm = -174 + 10*log10(B) + noiseFiguredB; 33 | sigma2 = db2pow(sigma2dBm); 34 | 35 | %Define the channel gain functions based on the 3GPP Urban Micro in 36 | %"Further advancements for E-UTRA physical layer aspects (Release 9)." 37 | %3GPP TS 36.814, Mar. 2010. Note that x is measured in m and that the 38 | %antenna gains are included later in the code 39 | pathloss_3GPP_LOS = @(x) db2pow(-28-20*log10(fc)-22*log10(x)); 40 | pathloss_3GPP_NLOS = @(x) db2pow(-22.7-26*log10(fc)-36.7*log10(x)); 41 | 42 | %Define the antenna gains at the source, relay/IRS, and destination. The 43 | %numbers are in linear scale 44 | antennaGainS = db2pow(5); 45 | antennaGainR = db2pow(5); 46 | antennaGainD = db2pow(0); 47 | 48 | %Set the amplitude reflection coefficient 49 | alpha = 1; 50 | 51 | %Set the range of rate values 52 | Rbar = [0.01 0.1:0.1:10]; 53 | 54 | %Set parameters related to circuit power consumption 55 | Ps = 100; %Power dissipation in the transceiver hardware of the source 56 | Pd = 100; %Power dissipation in the transceiver hardware of the destination 57 | Pe = 5; %Power dissipation per element in the IRS (mW) 58 | Pr = 100; %Power dissipation in the transceiver hardware of the relay 59 | nu = 0.5; %Efficiency of the power amplifier at the source 60 | 61 | 62 | %Define distances in simulation setup 63 | 64 | d_SR = 80; %Distance between the source and IRS/relay 65 | dv = 10; %Minimum distance between destination and the IRS/relay 66 | 67 | %Define the range of d1 values in the simulation setup 68 | d1 = 70; 69 | 70 | %Copmute distance between the source and destination 71 | d_SD = sqrt(d1^2+dv^2); 72 | 73 | %Compute distance between the IRS/relay and destination 74 | d_RD = sqrt((d1-d_SR)^2+dv^2); 75 | 76 | 77 | %Compute the channel gains using the 3GPP models and antenna gains 78 | betaSR = pathloss_3GPP_LOS(d_SR)*antennaGainS*antennaGainR; 79 | betaRD = pathloss_3GPP_LOS(d_RD)*antennaGainR*antennaGainD; 80 | betaSD = pathloss_3GPP_NLOS(d_SD)*antennaGainS*antennaGainD; 81 | 82 | 83 | %Prepare to save simulation results 84 | EE_SISO = zeros(length(Rbar),1); 85 | EE_IRS = zeros(length(Rbar),1); 86 | EE_DF = zeros(length(Rbar),1); 87 | Nopt = zeros(length(Rbar),1); 88 | 89 | 90 | %% Go through all rate values 91 | for ind = 1:length(Rbar) 92 | 93 | %Compute required SINR values 94 | SINR = 2^(Rbar(ind))-1; %SISO and IRS 95 | SINR_DF = 2^(2*Rbar(ind))-1; %DF relaying 96 | 97 | 98 | %Compute the transmit power in the SISO case, using Eq. (17) 99 | P_SISO = SINR*sigma2/betaSD; 100 | 101 | %Compute the energy efficiency in the SISO case 102 | %(the factor 1000 is used to convert mW to W) 103 | EE_SISO(ind) = 1000*B*Rbar(ind)/(P_SISO/nu + Ps + Pd); 104 | 105 | 106 | %Compute the transmit power in the DF relaying case, using Eq. (19) 107 | P_DF = SINR_DF*sigma2*(betaSR+betaRD-betaSD)/(2*betaRD*betaSR); 108 | 109 | %Compute the energy efficiency in the DF relaying case 110 | %(the factor 1000 is used to convert mW to W) 111 | EE_DF(ind) = 1000*B*Rbar(ind)/(P_DF/nu + Ps/2 + Pd + Pr); 112 | 113 | 114 | %Compute the power-minimizing number of reflecting elements 115 | Nopt(ind) = (2*SINR*sigma2/(nu*alpha^2*betaSR*betaRD*Pe))^(1/3) - sqrt(betaSD/(betaSR*betaRD))/alpha; 116 | 117 | if Nopt(ind)<0 118 | Nopt(ind) = 0; 119 | end 120 | 121 | %Compute the transmit power in the IRS case, using Eq. (18) 122 | P_IRS = SINR*sigma2./(sqrt(betaSD) + Nopt(ind)*alpha*sqrt(betaSR*betaRD)).^2; 123 | 124 | %Compute the energy efficiency in the IRS case 125 | %(the factor 1000 is used to convert mW to W) 126 | EE_IRS(ind) = 1000*B*Rbar(ind)/(P_IRS/nu + Ps + Pd + Nopt(ind)*Pe); 127 | 128 | end 129 | 130 | 131 | 132 | %Plot simulation results 133 | figure; 134 | hold on; box on; 135 | plot(Rbar,EE_DF/1e6,'b-.','LineWidth',2); 136 | plot(Rbar,EE_IRS/1e6,'r-','LineWidth',2); 137 | plot(Rbar,EE_SISO/1e6,'k--','LineWidth',2); 138 | xlabel('Achievable rate [bit/s/Hz]','Interpreter','Latex'); 139 | ylabel('Energy efficiency [Mbit/Joule]','Interpreter','Latex'); 140 | legend('DF relay','IRS','SISO','Location','NorthWest'); 141 | set(gca,'fontsize',18); 142 | -------------------------------------------------------------------------------- /simulateFigure4.m: -------------------------------------------------------------------------------- 1 | %%This Matlab script generates Figure 4 in the paper: 2 | % 3 | %Emil Björnson, Özgecan Özdogan, Erik G. Larsson, “Intelligent Reflecting 4 | %Surface vs. Decode-and-Forward: How Large Surfaces Are Needed to Beat 5 | %Relaying?,” IEEE Wireless Communications Letters, To appear 6 | % 7 | %Download article: https://arxiv.org/pdf/1906.03949 8 | % 9 | %This is version 1.0 (Last edited: 2019-10-28) 10 | % 11 | %License: This code is licensed under the GPLv2 license. If you in any way 12 | %use this code for research that results in publications, please cite our 13 | %paper as described above. 14 | 15 | 16 | close all; 17 | clear; 18 | 19 | 20 | %% Set simulation parameters 21 | 22 | %Carrier frequency (in GHz) 23 | fc = 3; 24 | 25 | %Bandwidth 26 | B = 10e6; 27 | 28 | %Noise figure (in dB) 29 | noiseFiguredB = 10; 30 | 31 | %Compute the noise power in dBm 32 | sigma2dBm = -174 + 10*log10(B) + noiseFiguredB; 33 | sigma2 = db2pow(sigma2dBm); 34 | 35 | %Define the antenna gains at the source, relay/IRS, and destination. The 36 | %numbers are in linear scale 37 | antennaGainS = db2pow(5); 38 | antennaGainR = db2pow(5); 39 | antennaGainD = db2pow(0); 40 | 41 | %Define the channel gain functions based on the 3GPP Urban Micro in 42 | %"Further advancements for E-UTRA physical layer aspects (Release 9)." 43 | %3GPP TS 36.814, Mar. 2010. Note that x is measured in m and that the 44 | %antenna gains are included later in the code 45 | pathloss_3GPP_LOS = @(x) db2pow(-28-20*log10(fc)-22*log10(x)); 46 | pathloss_3GPP_NLOS = @(x) db2pow(-22.7-26*log10(fc)-36.7*log10(x)); 47 | 48 | 49 | %Set the amplitude reflection coefficient 50 | alpha = 1; 51 | 52 | %Define the range of different number of reflection elements in the IRS 53 | Nrange = [25 50 100 150]; 54 | 55 | %Set the range of rate values 56 | Rbar = [4 6]; 57 | 58 | 59 | %Define distances in simulation setup 60 | 61 | d_SR = 80; %Distance between the source and IRS/relay 62 | dv = 10; %Minimum distance between destination and the IRS/relay 63 | 64 | %Define the range of d1 values in the simulation setup 65 | d1range = 40:100; 66 | 67 | 68 | %Prepare to save simulation results 69 | powerFractionRelay = zeros(length(d1range),length(Rbar)); 70 | Nmin = zeros(length(Rbar),1); 71 | 72 | 73 | %% Go through all rate values 74 | for ind = 1:length(Rbar) 75 | 76 | %Prepare to save transmit powers 77 | P_IRS = zeros(length(d1range),length(Nrange)); 78 | P_DF = zeros(length(d1range),1); 79 | P_SISO = zeros(length(d1range),1); 80 | 81 | %Compute required SINR values 82 | SINR = 2^(Rbar(ind))-1; %SISO and IRS 83 | SINR_DF = 2^(2*Rbar(ind))-1; %DF relaying 84 | 85 | 86 | %Go through all values of d1 87 | for k = 1:length(d1range) 88 | 89 | %Extract value of d1 90 | d1 = d1range(k); 91 | 92 | %Compute distance between the source and destination 93 | d_SD = sqrt(d1^2+dv^2); 94 | 95 | %Compute distance between the IRS/relay and destination 96 | d_RD = sqrt((d1-d_SR)^2+dv^2); 97 | 98 | 99 | %Compute the channel gains using the 3GPP models and antenna gains 100 | betaSR = pathloss_3GPP_LOS(d_SR)*antennaGainS*antennaGainR; 101 | betaRD = pathloss_3GPP_LOS(d_RD)*antennaGainR*antennaGainD; 102 | betaSD = pathloss_3GPP_NLOS(d_SD)*antennaGainS*antennaGainD; 103 | 104 | 105 | %Compute the transmit power in mW in the SISO case, using Eq. (11) 106 | P_SISO(k) = SINR*sigma2/betaSD; 107 | 108 | 109 | %Compute the transmit power in mW in the IRS case, using Eq. (12) 110 | P_IRS(k,:) = SINR*sigma2./(sqrt(betaSD) + Nrange*alpha*sqrt(betaSR*betaRD)).^2; 111 | 112 | 113 | %Compute the transmit power in mW in the DF relaying case, using Eq. (14) 114 | if betaSR>=betaSD 115 | P_DF(k) = SINR_DF*sigma2*(betaSR+betaRD-betaSD)/(2*betaRD*betaSR); 116 | powerFractionRelay(k,ind) = 2*(betaSR-betaSD)/(betaSR+betaRD-betaSD); 117 | else 118 | P_DF(k) = SINR_DF*sigma2/betaSD; 119 | powerFractionRelay(k,ind) = 0; 120 | end 121 | 122 | 123 | %Compute the number of reflecting elements needed to get a lower 124 | %transmit power with the IRS than with DF relaying 125 | if d1 == d_SR 126 | 127 | rho = P_DF(k)/sigma2; 128 | 129 | Nmin(ind) = sqrt((sqrt(1+rho*2*betaRD*betaSR/(betaSR+betaRD-betaSD))-1)/(rho*betaSR*betaRD))-sqrt(betaSD/(betaSR*betaRD)); 130 | 131 | end 132 | 133 | end 134 | 135 | 136 | 137 | %Plot simulation results 138 | figure; 139 | hold on; box on; 140 | plot(d1range,10*log10(P_SISO),'k--','LineWidth',2); 141 | plot(d1range,10*log10(P_IRS(:,1)),'r-','LineWidth',2); 142 | plot(d1range,10*log10(P_DF),'b-.','LineWidth',2); 143 | for n = 2:length(Nrange) 144 | plot(d1range,10*log10(P_IRS(:,n)),'r-','LineWidth',2); 145 | end 146 | xlabel('Distance $d_1$ [m]','Interpreter','Latex'); 147 | ylabel('Transmit power [dBm]','Interpreter','Latex'); 148 | legend('SISO','IRS','DF relay','Location','NorthWest'); 149 | set(gca,'fontsize',18); 150 | xlim([40 100]); 151 | 152 | end 153 | --------------------------------------------------------------------------------