Filter löschen
Filter löschen

I get this error: Incorrect number or types of inputs or outputs for function 'phaseShift' when I try to compile my code.

2 Ansichten (letzte 30 Tage)
Hi everyone. Could someone please explain what could be the cause of this error when I use the phaseShift function. Many thanks in advance.
%%Create Variables
clc
clear all
close all
freq = 5.33e9;
c = physconst("lightspeed");
lambda = c/freq;
%%Create pcbStack object
pcbobj = pcbStack;
%%Create board shape
%Creating BoardShape metal layer.
%Creating Rectangle shape.
Rectangle = antenna.Rectangle;
Rectangle.Name = "Rectangle";
Rectangle.Center = [0 0];
Rectangle.Length = 0.02725;
Rectangle.Width = 0.02725;
Rectangle = rotate(Rectangle,0,[Rectangle.Center,-1],[Rectangle.Center,1]);
BoardShape = Rectangle;
pcbobj.BoardShape = BoardShape;
%%Create Stackup
%Creating PatchLayer metal layer.
%Creating Patch shape.
Patch = antenna.Polygon;
Patch.Name = "Patch";
Patch.Vertices = [
-0.00775 0.0064 0;
0.00775 0.0064 0;
0.00775 -0.0064 0;
0.000535 -0.0064 0;
0.000535 -0.0015 0;
0.000375 -0.0015 0;
0.000375 -0.013625 0;
-0.000375 -0.013625 0;
-0.000375 -0.0015 0;
-0.000535 -0.0015 0;
-0.000535 -0.0064 0;
-0.00775 -0.0064 0];
Patch = rotate(Patch,0,[0 -0.00430416666666667 -1],[0 -0.00430416666666667 1]);
PatchLayer = Patch;
%Creating DielectricLayer dielectric layer.
DielectricLayer = dielectric("Name",'Custom',"EpsilonR",4.66,"LossTangent",0.026,"Thickness",0.0006);
%Creating GroundPlane metal layer.
%Creating Ground shape.
Ground = antenna.Rectangle;
Ground.Name = "Ground";
Ground.Center = [0 0];
Ground.Length = 0.02725;
Ground.Width = 0.02725;
Ground = rotate(Ground,0,[Ground.Center,-1],[Ground.Center,1]);
GroundPlane = Ground;
%%Create Feed
% feedloc = [[0 -0.006237 3 1];...
% ];
feedloc = [[0 -0.0064 3 1];...
];
%%Create Metal
metalobj = metal;
metalobj.Name = 'Copper';
metalobj.Conductivity = 5.96e7;
metalobj.Thickness = 35e-6;
pcbobj.Conductor = metalobj;
%%Assign propertie
pcbobj.BoardThickness = 0.00053;
pcbobj.Layers = {PatchLayer,DielectricLayer,GroundPlane,};
pcbobj.FeedLocations = feedloc;
pcbobj.FeedDiameter = 0.00030672;
pcbobj.ViaDiameter = 0.00075;
pcbobj.FeedViaModel = 'strip';
pcbobj.FeedVoltage = 1;
pcbobj.FeedPhase = 0;
figure('Position', [100 750 600 500]);
show(pcbobj)
figure('Position', [700 750 600 500]);
pattern(pcbobj,freq)
figure('Position', [1300 750 600 500]);
current(pcbobj,freq)
% antennaArray = rectangularArray;
antennaArray = phased.URA;
antennaArray.Element = pcbobj;
antennaArray.Size = [10 10];
antennaArray.ElementSpacing = lambda/2;
antennaArray.Lattice = "Rectangular";
antennaArray.ArrayNormal = "x";
figure('Position', [100 150 600 500]);
pattern(antennaArray, freq)
pos_rec = getElementPosition(antennaArray);
pos_yx_rec = pos_rec([2,3],:);
figure('Position', [700 150 600 500]);
plot(pos_yx_rec(1,:), pos_yx_rec(2,:), '.', 'MarkerSize', 10)
% axis([-0.2 0.2 -0.2 0.2])
xlabel('x'); ylabel('y')
title('Rectangular Lattice')
figure('Position', [1300 150 600 500]);
az_angle = -180:0.25:180;
pattern(antennaArray,freq, az_angle, 0, CoordinateSystem="rectangular")
axis([-90 90 -35 25])
ps = phaseShift(antennaArray, freq, [30 45]);

Antworten (1)

Sarthak
Sarthak am 30 Mai 2024
Hi Dmitry,
I faced the same issue as well. I think the phaseShift function cannot take an array of type phased.URA. Can you try using a regular rectangularArray?
I used an example from the documentation:
% Works
a = rectangularArray('Size',[3 3]);
ps = phaseShift(a,1.8e9,[30 45])
ps = 9x1
38.8723 127.2803 215.6883 271.5920 0 88.4080 144.3117 232.7197 321.1277
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
However,
% Doesn't work
array = phased.URA('Size',[3 3]);
ps = phaseShift(array,1.8e9,[30 45])
Incorrect number or types of inputs or outputs for function phaseShift.
Not sure if this is the expected behavior, but worked for me.
Cheers!
  4 Kommentare
Dmitry Ilinsky
Dmitry Ilinsky am 31 Mai 2024
Bearbeitet: Dmitry Ilinsky am 31 Mai 2024
Could the problem be that the default antenna inset fed is pointing parallel to the x-axis instead of perpendicular? Perhaps it needs to be rotated?
antenna = patchMicrostripInsetfed;
show(antenna)
Dmitry Ilinsky
Dmitry Ilinsky am 31 Mai 2024
Rotating didn't help. Same error
antenna = patchMicrostripInsetfed;
antenna.Tilt = 90;
antenna.TiltAxis = [0 0 1];
show(antenna)
antennaArray = rectangularArray;
antennaArray.Element = antenna;
Error using em.Array/setElementAsScalarHandle
patchMicrostripInsetfed as Element is not supported for Arrays.

Error in em.ArrayProp/set.Element (line 73)
setElementAsScalarHandle(obj,propVal,excludeClass1,excludeClass2);

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Custom Geometry and PCB Fabrication finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by