# Sensitivity Analysis Using Exported Script from Satellite Link Budget Analyzer

This example shows how to perform sensitivity analysis by using MATLAB® script exported from the Satellite Link Budget Analyzer app.

### Introduction

Sensitivity analysis is the process of determining the impact of link budget parameters on link performance. In this example, you compare the link margins for different modulation schemes by using a script exported from the Satellite Link Budget Analyzer app.

To analyze the link budget for different modulation schemes, follow these steps:

1. Estimate the required bit-energy-to-noise-density ratio (Eb/No) at a target bit error rate (BER) for different modulation schemes.

2. Calculate and visualize the link budget results by using an exported MATLAB script.

### Estimate Required Eb/No Using BER Analysis App

To estimate the required Eb/No at a target BER for different modulation schemes, use the Bit Error Rate Analysis app. To calculate BER as a function of Eb/No, app uses theoretical closed-form expressions or Monte Carlo simulations. If the theoretical closed-form expression is not available for a modulation scheme, you can use Monte Carlo simulations instead. This example considers these modulation schemes and their corresponding required Eb/No values at a BER of `1e-5`.

• BPSK - Eb/No of `9.56` dB. BER data is from theoretical close-form expression.

• 8PSK - Eb/No of `12.97` dB. BER data is from theoretical close-form expression.

• 8APSK - Eb/No of `17.68` dB. BER data is from Monte Carlo simulations in AWGN channel. Constellations points and radius per PSK ring are `[2 4 2]` and `[0.1471 0.7824 1]`, respectively.

• 16APSK - Eb/No of `14.58` dB. BER data is from Monte Carlo simulations in AWGN channel. Constellations points and radius per PSK ring are `[4 12]` and `[0.3175 1]`, respectively.

To improve the BER performance, this example considers `1/2` rate convolutional encoding with a constraint length of `7`. Coding gains for the modulation schemes at a BER of `1e-5` are given below.

• BPSK - Coding gain of `5.41` dB. BER data is from theoretical close-form expression.

• 8PSK - Coding gain of `3.60` dB. BER data is from theoretical close-form expression.

• 8APSK - Coding gain of `11.23` dB. BER data is from Monte Carlo simulations in AWGN channel.

• 16APSK - Coding gain of `7.26 `dB. BER data is from Monte Carlo simulations in AWGN channel.

### Calculate and Visualize Link Budget Results Using Exported Script

The Satellite Link Budget Analyzer app can perform sensitivity analysis for uplink (L1), downlink (L2), and crosslink (L3). This example considers only uplink for the sensitivity analysis. The link L1 is an uplink between the ground station G1 and the satellite S1. To generate the equivalent MATLAB code from the Satellite Link Budget Analyzer app, on the app toolstrip, click Export Script.

This figure shows a part of the generated script from the Satellite Link Budget Analyzer app.

To study the link margins for a pool of modulation schemes, you must modify the script. To calculate and visualize link budget results, follow these steps.

1. Modify the generated MATLAB script to support a vector of required Eb/No values. By default, this example uses the values from the Estimate Required Eb/No Using BER Analysis App section.

```%% Ground station (G1) properties g1.Latitude = 42.3; % deg g1.Longitude = -71.35; % deg g1.Altitude = 20; % m %% Satellite (S1) properties s1.Latitude = 35; % deg s1.Longitude = -40; % deg s1.Altitude = 2000; % km %% Ground station (G1) transmitter properties tx1.TxFeederLoss = 2; % dB tx1.OtherTxLosses = 3; % dB tx1.TxHPAPower = 14; % dBW tx1.TxHPAOBO = 6; % dB tx1.TxAntennaGain = 30; % dBi %% Satellite (S1) receiver properties rx1.InterferenceLoss = 2; % dB rx1.RxGByT = 25; % dB/K rx1.RxFeederLoss = 1; % dB rx1.OtherRxLosses = 1; % dB %% Link (L1) properties l1.Frequency = 14; % GHz l1.Bandwidth = 6; % MHz l1.BitRate = 10; % Mbps l1.RequiredEbByNo = 10; % dB l1.Availability = 99.9; % % l1.PolarizationMismatch = 45; % deg l1.ImplementationLoss = 2; % dB l1.AntennaMispointingLoss = 1; % dB l1.RadomeLoss = 1; % dB % Required Eb/No for the modulation schemes modscheme = ["BPSK"; "8PSK"; "8APSK"; "16APSK"]; % Modulation schemes ebNoVector = [9.56 12.9685 18.16 15.19]; % dB, Required Eb/No for modulation schemes codingGain = [5.41 3.60 11.23 7.26]; % dB, Coding gains for modulation schemes with 1/2 rate convolutional encoding```

2. To include ITU-R P.618 propagation losses, download MAT files that contain digital maps extracted from International Telecommunication Union (ITU) documents.

```% Download and extract the digital maps, if not available on path maps = exist("maps.mat","file"); p836 = exist("p836.mat","file"); p837 = exist("p837.mat","file"); p840 = exist("p840.mat","file"); matFiles = [maps p836 p837 p840]; if ~all(matFiles) if ~exist("ITURDigitalMaps.tar.gz","file") url = "https://www.mathworks.com/supportfiles/spc/P618/ITURDigitalMaps.tar.gz"; websave("ITURDigitalMaps.tar.gz",url); untar("ITURDigitalMaps.tar.gz"); else untar("ITURDigitalMaps.tar.gz"); end addpath(cd) end```

3. Calculate the link budget for a vector of required Eb/No values by using the `calculateLinkBudget` local function.

```% Calculate the link budget len = length(ebNoVector); resvec = cell(1,len); name = strings(1,len); lnk = repmat({l1},1,len); for ii = 1:len l1.RequiredEbByNo = ebNoVector(ii) - codingGain(ii); % dB resvec{ii} = calculateLinkBudget(g1,s1,tx1,rx1,l1); lnk{ii}.RequiredEbByNo = l1.RequiredEbByNo; name(ii) = "L1 (" + modscheme(ii) + ")"; % Link name with suffix end colName = ["Tag" "Name" name];```

4. Visualize the link budget results in a table.

```% Visualize the results in a table res = [resvec{:}]; data = {'N1','Distance (km)',res.Distance; ... 'N2','Elevation (deg)',res.Elevation; ... 'N3','Tx EIRP (dBW)',res.TxEIRP; ... 'N4','Polarization loss (dB)',res.PolarizationLoss; ... 'N5','FSPL (dB)',res.FSPL; ... 'N6','Rain attenuation (dB)',res.RainAttenuation;... 'N7','Total atmospheric losses (dB)',res.TotalAtmosphericLosses; ... 'N8','Total propagation losses (dB)',res.TotalPropagationLosses; ... 'N9','Received isotropic power (dBW)',res.ReceivedIsotropicPower; ... 'N10','C/No (dB-Hz)',res.CByNo; ... 'N11','C/N (dB)',res.CByN; ... 'N12','Received Eb/No (dB)',res.ReceivedEbByNo; ... 'N13','Margin (dB)',res.Margin}; fig = uifigure(Name="Link Budget"); fig.Position(3:4) = [630 331]; uit = uitable(fig, units="normalized",... Position=[0 0 1 1], RowName={},... ColumnName=colName, Data=data);```

5. Visualize the link margin for different modulation schemes with a stem plot.

```% Plot with link margin results for multiple modulation schemes stem([res.Margin],"*") title("Link Margin Vs Modulation Scheme") ylabel("Margin (dB)") xlabel("Modulation Scheme") xticks(1:len) xticklabels(modscheme) grid on```

### Further Exploration

In this example, you calculated the link margins for BPSK, 8PSK, 8APSK, and 16APSK by using a MATLAB script generated from the Satellite Link Budget Analyzer app. Try running this example with these modifications.

• Observe the link margin for other modulation schemes.

• Observe the link margin with coding gain of other error-control channel coding techniques.

• Observe the link margin for different M-APSK constellations. For more information, see `apskmod` and `dvbsapskmod`.

• `C`onsider any property of the ground station, transmitter, receiver, link, or satellite as a vector.

### References

[1] International Telecommunication Union. P.618: Propagation Data and Prediction Methods Required for the Design of Earth-Space Telecommunications Systems. Recommendation P.618-13 (12/2017). ITU-R, approved December 4, 2017.

[2] European Telecommunications Standards Institute (ETSI). Digital Video Broadcasting (DVB); Second Generation Framing Structure, Channel Coding and Modulation Systems for Broadcasting, Interactive Services, News Gathering and Other Broadband Satellite Applications (DVB-S2). ETSI EN 302 307-1 V1.4.1 (2014-11). France: ETSI, November, 2014.

[3] European Telecommunications Standards Institute (ETSI). Digital Video Broadcasting (DVB); Second Generation Framing Structure, Channel Coding and Modulation Systems for Broadcasting, Interactive Services, News Gathering and Other Broadband Satellite Applications; Part 2: DVB-S2 extensions (DVB-S2X). ETSI EN 302 307-2 V1.1.1 (2015-11). France: ETSI, November, 2015.

### Local Function

`calculateLinkBudget `- Calculates the link budget result parameters.

```function res = calculateLinkBudget(spec,sat,tx,rx,lnk,varargin) assignin("base","struct1",spec); assignin("base","struct2",sat); assignin("base","struct3",tx); assignin("base","struct4",rx); assignin("base","struct5",lnk); resultProperty = []; resultVariable = []; if nargin > 5 resultVariable = varargin{1}; end if nargin == 8 resultProperty = varargin{2}; resultValue = varargin{3}; end params = {"Distance";"Elevation";"TxEIRP";"PolarizationLoss";... "FSPL";"RainAttenuation";"TotalAtmosphericLosses";"TotalPropagationLosses";... "ReceivedIsotropicPower";"CByNo";"CByN";"ReceivedEbByNo";... "Margin"}; eqns = {"satcom.internal.linkbudgetApp.computeDistance(struct1.Latitude, struct1.Longitude, struct1.Altitude, struct2.Latitude, struct2.Longitude, struct2.Altitude*1e3)";... "satcom.internal.linkbudgetApp.computeElevation(struct1.Latitude, struct1.Longitude, struct1.Altitude, struct2.Latitude, struct2.Longitude, struct2.Altitude*1e3)";... "struct3.TxHPAPower - struct3.TxHPAOBO - struct3.TxFeederLoss - struct3.OtherTxLosses + struct3.TxAntennaGain - struct5.RadomeLoss";... "20 * abs(log10(cosd(struct5.PolarizationMismatch)))";... "fspl(temp.Distance * 1e3, physconst('LightSpeed') ./ (struct5.Frequency*1e9))";... "satcom.internal.linkbudgetApp.computeRainAttenuation(struct5.Availability, struct1.Latitude, struct1.Longitude, struct1.Altitude, struct5.Frequency, temp.Elevation, struct3.TxAntennaGain)";... "satcom.internal.linkbudgetApp.computeTotalAtmLosses(struct5.Availability, struct1.Latitude, struct1.Longitude, struct1.Altitude, struct5.Frequency, temp.Elevation, struct3.TxAntennaGain)";... "temp.FSPL+temp.TotalAtmosphericLosses";... "temp.TxEIRP - temp.PolarizationLoss - temp.TotalPropagationLosses - struct4.InterferenceLoss - struct5.AntennaMispointingLoss";... "temp.ReceivedIsotropicPower + struct4.RxGByT - 10*log10(physconst('Boltzmann')) - struct4.RxFeederLoss - struct4.OtherRxLosses";... "temp.CByNo - 10*log10(struct5.Bandwidth) - 60";... "temp.CByNo - 10*log10(struct5.BitRate) - 60";... "temp.ReceivedEbByNo - struct5.RequiredEbByNo - struct5.ImplementationLoss"}; if nargin == 7 vectorSpecValue = varargin{2}; eqns{1} = mat2str(vectorSpecValue); end for ii = 1:length(params) varname = strcat("temp.",params{ii}); if any(strcmp(resultProperty,params{ii})) evalin("base",sprintf("%s = %f;",varname,resultValue(strcmp(resultProperty,params{ii})))) else evalin("base",sprintf("%s = %s;",varname,eqns{ii})) end if strcmp(resultVariable,params{ii}) && ~isempty(resultVariable) break; end end res = evalin("base","temp"); evalin("base","clear struct1 struct2 struct3 struct4 struct5 temp"); end```