erro: Incorrect number or types of inputs or outputs for function location
Show older comments
o meu codigo esta aparecendoo o seguinte erro ''Incorrect number or types of inputs or outputs for function location'' e não estou entendendo o porque
meu codigo:
clear all
% Crie sites de transmissão de células
% Crie sites de transmissão de células
names = ["jaguaribe" "centro" "jaguaribecentro"];
lats = [-5.895806113892169, -5.895456726608638, -5.894977218173506];
longs = [-38.62032597572306, -38.62222432683183, -38.62401029975932];
macro = txsite('Name', names, 'Latitude', lats, 'Longitude', longs, 'CoordinateSystem', 'geographic');
centerSite = geopoint(-5.895806113892169, -38.62032597572306); % Substitua por sua latitude e longitude
% Initialize arrays for distance and angle from center location to each cell site, where
% each site has 3 cells
numCellSites = 36;
siteDistances = zeros(1,numCellSites);
siteAngles = zeros(1,numCellSites);
% Define distance and angle for inner ring of 6 sites (cells 4-21)
isd = 200; % Inter-site distance
siteDistances(2:7) = isd;
siteAngles(2:7) = 30:60:360;
% Define distance and angle for middle ring of 6 sites (cells 22-39)
siteDistances(8:13) = 2*isd*cosd(30);
siteAngles(8:13) = 0:60:300;
% Define distance and angle for outer ring of 6 sites (cells 40-57)
siteDistances(14:19) = 2*isd;
siteAngles(14:19) = 30:60:360;
% Initialize arrays for cell transmitter parameters
numCells = numCellSites*3;
cellLats = zeros(1,numCells);
cellLons = zeros(1,numCells);
cellNames = strings(1,numCells);
cellAngles = zeros(1,numCells);
% Define cell sector angles
cellSectorAngles = [30 150 270];
% For each cell site location, populate data for each cell transmitter
cellInd = 1;
for siteInd = 1:numCellSites
% Compute site location using distance and angle from center site
[cellLat,cellLon] = location(centerSite, siteDistances(siteInd), siteAngles(siteInd));
% Assign values for each cell
for cellSectorAngle = cellSectorAngles
cellNames(cellInd) = "Cell " + cellInd;
cellLats(cellInd) = cellLat;
cellLons(cellInd) = cellLon;
cellAngles(cellInd) = cellSectorAngle;
cellInd = cellInd + 1;
end
end
'AntennaAngle25',macroAngles = [30, 45, 60] ...
'AntennaHeight', macroantHeight = 10;
'TransmitterFrequency', macrofq = 3.5e9; % Frequência do portador (4 GHz) para Dense Urban-eMBB
'TransmitterPower', macroTxPower = 10.^((44-30)/10); % Converta dBm para W
% Define transmitter parameters using Table 8-2 (b) of Report ITU-R M.[IMT-2020.EVAL]
%fq = 3.5e9; % Carrier frequency (4 GHz) for Dense Urban-eMBB
%antHeight = 10; % m
%txPowerDBm = 44; % Total transmit power in dBm
%txPower = 10.^((txPowerDBm-30)/10); % Convert dBm to W
% Launch Site Viewer
viewer = siteviewer;
% Show sites on a map
show(macro);
viewer.Basemap = 'topographic';
Answers (1)
Shashi Kiran
on 12 Nov 2024
I see that you are working on setting up a cellular network site and transmitter configuration for a multi-sector cell simulation in MATLAB, but you have encountered the error: “Incorrect number or types of inputs or outputs for function location.”
After reviewing your code, it seems that this error arises because the code is currently using a "geopoint" object as an input to the "location" function, which actually expects a "txsite" object.
To resolve this, you can modify the centerSite definition to use "txsite" instead of "geopoint", as shown below:
centerSite = txsite('Name', 'center', 'Latitude', -5.895806113892169, 'Longitude', -38.62032597572306);
Here is the attached output with the above adjustment for your reference:

Refer to the following documentations for more details about the functions:
- location: https://www.mathworks.com/help/comm/ref/txsite.location.html
- txsite: https://www.mathworks.com/help/comm/ref/txsite.html
Hope this solves your query.
Categories
Find more on Communications Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!