Planning a 5G Fixed Wireless Access Link over Terrain - Not run

조회 수: 13(최근 30일)
I am running the original code of the MATLAB website
And in the next part I get an error message:
% Design reflector-backed crossed dipole antenna
txElement = reflectorCrossedDipoleElement(fq); % this is not run
% Define array size
ntxrow = 8;
ntxcol = 12;
% Define element spacing
lambda = physconst("lightspeed")/fq;
drow = lambda/2;
dcol = lambda/2;
% Create 8-by-12 antenna array
tx.Antenna = phased.URA("Size",[ntxrow ntxcol], ...
"Element",txElement, ...
"ElementSpacing",[drow dcol]);
% Plot pattern on the map
Undefined function 'reflectorDipoleElement' for input
arguments of type 'double'.
Error in pop3 (line 60)
rxElement = reflectorDipoleElement(fq);
Am I missing TOOLBOX or why doesn't it work?
  댓글 수: 1
Satyanand Singh
Satyanand Singh 2023년 4월 11일
function element = reflectorCrossedDipoleElement(fq, showAntenna)
%reflectorCrossedDipoleElement Design reflector-backed crossed dipole antenna element
if nargin < 2
showAntenna = false;
lambda = physconst("lightspeed")/fq;
offset = lambda/50;
gndspacing = lambda/4;
gndLength = lambda;
gndWidth = lambda;
% Design crossed dipole elements
d1 = design(dipole,fq);
d1.Tilt = [90,-45];
d1.TiltAxis = ["y","z"];
d2 = copy(d1);
d2.Tilt = 45;
d2.TiltAxis = "x";
% Design reflector
r = design(reflector,fq);
r.Exciter = d1;
r.GroundPlaneLength = gndLength;
r.GroundPlaneWidth = gndWidth;
r.Spacing = gndspacing;
r.Tilt = 90;
r.TiltAxis = "y";
if showAntenna
% Form the crossed dipole backed by reflector
refarray = conformalArray;
refarray.ElementPosition(1,:) = [gndspacing 0 0];
refarray.ElementPosition(2,:) = [gndspacing+offset 0 0];
refarray.Element = {r, d2};
refarray.Reference = "feed";
refarray.PhaseShift = [0 90];
if showAntenna
% Create custom antenna element from pattern
[g,az,el] = pattern(refarray,fq);
element = phased.CustomAntennaElement;
element.AzimuthAngles = az;
element.ElevationAngles = el;
element.MagnitudePattern = g;
element.PhasePattern = zeros(size(g));
function element = reflectorDipoleElement(fq)
%reflectorDipoleElement Design reflector-backed dipole antenna element
% Design reflector and exciter, which is vertical dipole by default
element = design(reflector,fq);
element.Exciter = design(element.Exciter,fq);
% Tilt antenna element to radiate in xy-plane, with boresight along x-axis
element.Tilt = 90;
element.TiltAxis = "y";
element.Exciter.Tilt = 90;
element.Exciter.TiltAxis = "y";

댓글을 달려면 로그인하십시오.


Abderrahim. B
Abderrahim. B 2022년 8월 12일
편집: Abderrahim. B 2022년 8월 12일
reflectorDipoleElement is a function in your live script. Scroll down to the bottom of the script and see if it is there, maybe it has a different name!
I have run the same example, and it worked for me. I am using MATLAB 2022A, latest update.
Some tips to fix the error:
  • Check fq data type
  • Do some debugging
  • Check if you have antenna toolbox, and all the other required products
Hope this helps




Community Treasure Hunt

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

Start Hunting!

Translated by