modify 'phased.FreeSpace' function or include other channel model

5 次查看(过去 30 天)
Recently, I'd like to implement Path loss exponent and distance estimation in a short-range wireless network, and plan to use phased.FreeSpace function and modify it to adapt lognormal path loss and shadowing model to derive path loss exponent and distance. Can any one has solutions to achieve this work?
  3 个评论
Da-Ren Chen
Da-Ren Chen 2023-5-15
the matlab code is as follows:
f=2.4e9; %Transmitted signal frequency in Hertz
waveform = phased.RectangularWaveform('SampleRate',5e6,...
'PulseWidth',6e-7,'OutputFormat','Pulses',...
'NumPulses',1,'PRF',1e2);
target = phased.RadarTarget('Model','Nonfluctuating',...
'MeanRCS',1,'OperatingFrequency',5.88e9);
targetpos = phased.Platform('InitialPosition',[1; 1; 1],...
'Velocity',[0.5; 0.5; 0]);
antenna = phased.IsotropicAntennaElement(...
'FrequencyRange',[5e8 f]);
transmitter = phased.Transmitter('PeakPower',1e-3,'Gain',0,...
'InUseOutputPort',true);
transpos = phased.Platform('InitialPosition',[1;1;0.1],...
'Velocity',[0;0;0]);
radiator = phased.Radiator('OperatingFrequency',f,'Sensor',antenna);
collector = phased.Collector('OperatingFrequency',f,'Sensor',antenna);
channel = phased.FreeSpace('SampleRate',waveform.SampleRate,...
'OperatingFrequency',f,'TwoWayPropagation',false);
receiver = phased.ReceiverPreamp('Gain',0,'LossFactor',3,...
'SampleRate',5e6,'NoiseFigure',5,...
'EnableInputPort',true,'SeedSource','Property','Seed',1e3);
I would like to change the channel using phased.FreeSpace() which is based on the custom lognormal pathloss and shadowing, not just freesapace model.
thanks!
Da-Ren Chen
Da-Ren Chen 2023-5-15
the custom lognormal pathloss and shadowing function is as follows:
function [PL,Pr_dBm] = logNormalShadowing(Pt_dBm,Gt_dBi,Gr_dBi,f,d0,d,L,sigma,n)
%Pt_dBm = Transmitted power in dBm
%Gt_dBi = Gain of the Transmitted antenna in dBi
%Gr_dBi = Gain of the Receiver antenna in dBi
%f = frequency of transmitted signal in Hertz
%d0 = reference distance of receiver from the transmitter in meters
%d = array of distances at which the loss needs to be calculated
%L = Other System Losses, for no Loss case L=1
%sigma = Standard deviation of log Normal distribution (in dB)
%n = path loss exponent
%Pr_dBm = Received power in dBm
%PL = path loss due to log normal shadowing
lambda=3*10^8/f; %Wavelength in meters 計算出波長,單位為公尺
K = 20*log10(lambda/(4*pi)) - 10*n*log10(d0) - 10*log10(L);%path-loss factor
X = sigma*randn(1,numel(d)); %normal random variable
PL = Gt_dBi + Gr_dBi + K -10*n*log10(d/d0) - X ;%PL(d) including antennas gains
Pr_dBm = Pt_dBm + PL; %Receieved power in dBm at d meters
end

请先登录,再进行评论。

回答(1 个)

Anshuman
Anshuman 2023-5-15
Hi,
Yes, it is possible to modify the 'phased.FreeSpace' function in MATLAB to accommodate the lognormal path loss and shadowing models, and use it to estimate the path loss exponent and distance in a short-range wireless network. Here are the steps that you can follow:
  1. Create a custom function in MATLAB that takes the input parameters required for the lognormal path loss and shadowing models, such as the frequency, antenna heights, and shadowing standard deviation, and returns the path loss exponent and distance between the transmitter and receiver.
  2. Use the 'phased.FreeSpace' function as a template for your custom function. Create a copy of the 'phased.FreeSpace' function and rename it to a descriptive name, such as 'pathLossEstimator'.
  3. Modify the copied function to include the lognormal path loss and shadowing models. You can add additional input parameters and processing steps as needed to implement these models. For example, you could add an input parameter for shadowing standard deviation and use it to compute the received power with a lognormal distribution.
  4. Test your custom function with simulated or measured data to verify its accuracy and compare it with the 'phased.FreeSpace' model. You can also use different statistical methods to improve the accuracy of your model.
Here is the sample code implementation:
function [PL_exp, d] = pathLossEstimator(pt, freq, ht, hr, shadowingStdDev, Pr)
c = physconst('LightSpeed');
lambda = c/freq;
a = ((4*pi*ht*hr)/lambda)^2;
% Compute path loss exponent
Pr_ref = pt*getFreeSpaceLoss(freq, ht, hr);
PL_exp = log10(Pr_ref/Pr)/(10*log10(d_ref/d));
% Compute distance
Pr_lognormal = Pr_ref/(d^PL_exp);
Pr_shadowing = Pr_lognormal + shadowingStdDev*randn();
Pr_real = abs(Pr_shadowing);
d = sqrt((pt*Pr_real*a)/(4*pi*Pr_ref));
end
Note that this is just an example implementation and that there might be various factors to consider while optimizing the models based on different scenarios.
Hope it helps!
  2 个评论
Da-Ren Chen
Da-Ren Chen 2023-5-15
the custome lognormal pathloss and shadowing is listed below:
function [PL,Pr_dBm] = logNormalShadowing(Pt_dBm,Gt_dBi,Gr_dBi,f,d0,d,L,sigma,n)
%Pt_dBm = Transmitted power in dBm
%Gt_dBi = Gain of the Transmitted antenna in dBi
%Gr_dBi = Gain of the Receiver antenna in dBi
%f = frequency of transmitted signal in Hertz
%d0 = reference distance of receiver from the transmitter in meters
%d = array of distances at which the loss needs to be calculated
%L = Other System Losses, for no Loss case L=1
%sigma = Standard deviation of log Normal distribution (in dB)
%n = path loss exponent
%Pr_dBm = Received power in dBm
%PL = path loss due to log normal shadowing
lambda=3*10^8/f; %Wavelength in meters 計算出波長,單位為公尺
K = 20*log10(lambda/(4*pi)) - 10*n*log10(d0) - 10*log10(L);%path-loss factor
X = sigma*randn(1,numel(d)); %normal random variable
PL = Gt_dBi + Gr_dBi + K -10*n*log10(d/d0) - X ;%PL(d) including antennas gains
Pr_dBm = Pt_dBm + PL; %Receieved power in dBm at d meters
end
in the second step you provided, how can I get the original 'phased.FreeSpace' function? and how to replace it with the proposed lognormal pathloss and shadowing function? or modified it?
Thanks!
Da-Ren Chen
Da-Ren Chen 2023-5-15
the matlab code is as follows:
f=2.4e9; %Transmitted signal frequency in Hertz
waveform = phased.RectangularWaveform('SampleRate',5e6,...
'PulseWidth',6e-7,'OutputFormat','Pulses',...
'NumPulses',1,'PRF',1e2);
target = phased.RadarTarget('Model','Nonfluctuating',...
'MeanRCS',1,'OperatingFrequency',5.88e9);
targetpos = phased.Platform('InitialPosition',[1; 1; 1],...
'Velocity',[0.5; 0.5; 0]);
antenna = phased.IsotropicAntennaElement(...
'FrequencyRange',[5e8 f]);
transmitter = phased.Transmitter('PeakPower',1e-3,'Gain',0,...
'InUseOutputPort',true);
transpos = phased.Platform('InitialPosition',[1;1;0.1],...
'Velocity',[0;0;0]);
radiator = phased.Radiator('OperatingFrequency',f,'Sensor',antenna);
collector = phased.Collector('OperatingFrequency',f,'Sensor',antenna);
channel = phased.FreeSpace('SampleRate',waveform.SampleRate,...
'OperatingFrequency',f,'TwoWayPropagation',false);
receiver = phased.ReceiverPreamp('Gain',0,'LossFactor',3,...
'SampleRate',5e6,'NoiseFigure',5,...
'EnableInputPort',true,'SeedSource','Property','Seed',1e3);
I would like to change the channel using phased.FreeSpace() which is based on the custom lognormal pathloss and shadowing, not just freesapace model.
thanks!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Communications Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by