IMPLEMENTATION OF ANTENNA ARRAY(CONCENTRIC CIRCULAR) USING MATLAB FUNCTION IN SIMULINK
3 views (last 30 days)
Show older comments
Hi
I am tring to implement concentric circular arrays using simulink,phased array toolbox. Narrowband tx and rx array couldn't be used as they don't have concentric circular arrays as i/p , they have only (ura uca ula) .
So I thought as sensor array app gives the .m file of CCA, I can implement it by creating matlab function but they throwing errors.
Simulink does not have enough information to determine output sizes for this block. If you think the errors below are inaccurate, try specifying types for the block inputs and/or sizes for the block outputs.
I have attached the matlab code and block pls look into them and help
MATLAB CODE
function [u,v,x]= cca48ele(n,radius,l2,l4)
shift = 0;
% The multiplication factor for lambda units to meter conversion
if length(n) == 1
n = n*ones(1, length(radius));
end
Nelements = sum(n);
stop = cumsum(n);
start = stop - n + 1;
actual_pos = zeros(3, Nelements);
for idx = 1:length(n)
angles = (0:n(idx)-1)*360/n(idx);
angles = angles + shift;
shift = sum(angles(1:2))/2;
pos = [zeros(1, length(angles));cosd(angles);sind(angles)];
actual_pos(:, start(idx):stop(idx)) = pos*radius(idx);
end
elNormal = [ones(1,Nelements);zeros(1,Nelements)];
Array = phased.ConformalArray('ElementPosition', actual_pos, ...
'ElementNormal', elNormal,'Taper',[exp(i*l2*0) exp(i*l2*1.5707) exp(i*l2*3.1415) exp(i*l2*4.7123) exp(i*l4*0) exp(i*l4*0.7853) exp(i*l4*1.5707) exp(i*l4*2.356) exp(i*l4*3.1415) exp(i*l4*3.9269) exp(i*l4*4.7123) exp(i*l4*5.4977)]);
% Create an isotropic antenna element
Elem = phased.IsotropicAntennaElement;
Elem.FrequencyRange = [0 28500000000];
Array.Element = Elem;
% Assign Frequencies and Propagation Speed
Frequency = 28500000000;
PropagationSpeed = 300000000;
% Create Figure
% Plot Array Geometry
figure;
viewArray(Array,'ShowNormal',false,...
'ShowTaper',false,'ShowIndex','None');
% Calculate Steering Weights
Freq3D = 28500000000;
% Find the weights
w = ones(getNumElements(Array), length(Frequency));
% Plot 3d graph
format = 'polar';
figure;
pattern(Array, Freq3D , 'PropagationSpeed', PropagationSpeed,...
'Type','directivity', 'CoordinateSystem', format,'weights', w(:,1));
% Find the weights
w = ones(getNumElements(Array), length(Frequency));
% Plot 2d elevation graph
format = 'polar';
cutAngle = 0;
figure;
pattern(Array, Frequency, cutAngle, -90:90, 'PropagationSpeed', PropagationSpeed,...
'Type', 'directivity', 'CoordinateSystem', format ,'weights', w);
format = 'rectangular';
cutAngle = 0;
figure;
pattern(Array, Frequency, cutAngle, -90:90, 'PropagationSpeed', PropagationSpeed,...
'Type', 'directivity', 'CoordinateSystem', format ,'weights', w);
u=pattern(Array, Freq3D , 'PropagationSpeed', PropagationSpeed,...
'Type','directivity', 'CoordinateSystem', format,'weights', w(:,1));
v=pattern(Array, Frequency, cutAngle, -90:90, 'PropagationSpeed', PropagationSpeed,...
'Type', 'directivity', 'CoordinateSystem', format ,'weights', w);
x=pattern(Array, Frequency, cutAngle, -90:90, 'PropagationSpeed', PropagationSpeed,...
'Type', 'directivity', 'CoordinateSystem', format ,'weights', w);
end
error:
Component: MATLAB Function | Category: Coder error
Code generation is not supported for viewArray.
Function 'MATLAB Function' (#54.1223.1301), line 40, column 1:
"viewArray(Array,'ShowNormal',false,..."
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Code generation is not supported for pattern.
Function 'MATLAB Function' (#54.1470.1603), line 52, column 1:
"pattern(Array, Freq3D , 'PropagationSpeed', PropagationSpeed,..."
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Code generation is not supported for pattern.
Function 'MATLAB Function' (#54.1608.1741), line 55, column 3:
"pattern(Array, Freq3D , 'PropagationSpeed', PropagationSpeed,..."
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Code generation is not supported for pattern.
Function 'MATLAB Function' (#54.1881.2031), line 64, column 1:
"pattern(Array, Frequency, cutAngle, -90:90, 'PropagationSpeed', PropagationSpeed"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Code generation is not supported for pattern.
Function 'MATLAB Function' (#54.2035.2185), line 66, column 3:
"pattern(Array, Frequency, cutAngle, -90:90, 'PropagationSpeed', PropagationSpeed"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Code generation is not supported for pattern.
Function 'MATLAB Function' (#54.2233.2383), line 71, column 1:
"pattern(Array, Frequency, cutAngle, -90:90, 'PropagationSpeed', PropagationSpeed"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Code generation is not supported for pattern.
Function 'MATLAB Function' (#54.2387.2537), line 73, column 3:
"pattern(Array, Frequency, cutAngle, -90:90, 'PropagationSpeed', PropagationSpeed"
Launch diagnostic report.
Component: MATLAB Function | Category: Coder error
Errors occurred during parsing of MATLAB function 'cca48/MATLAB Function'
Component: MATLAB Function | Category: Coder error
Simulink cannot determine sizes and/or types of the outputs for block 'cca48/MATLAB Function' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component: MATLAB Function | Category: Coder error
Simulink cannot determine sizes and/or types of the outputs for block 'cca48/MATLAB Function' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Component: Simulink | Category: Model error
Error occurred in 'cca48/MATLAB Function'.
Component: Simulink | Category: Model error
These are the errors I am getting.
I think CCA can be implemented using matlab function but I am not able to do, can you pls help me with this.
Thanking you!!!!
0 Comments
Accepted Answer
Walter Roberson
on 4 Oct 2021
viewArray() and pattern() cannot have code generated for them.
Generally speaking, it is common for graphic functions such as pattern() to be considered to be small "applications" -- graphics with behaviour attached, rather than just plain plotting.
Code generation generally does not like to do plotting. To the extent that plotting is possible, you need coder.extrinsic and you need to have rapid acceleration turned off so that everything is interpreted as MATLAB code.
7 Comments
Walter Roberson
on 4 Oct 2021
I speculate that when you used coder.extrinsic() that Simulink is not able to recognize that you are invoking a method of an object, rather than a stand-alone function.
I do not know how to deal with the situation -- other than not calling pattern() or viewArray()
The only relevant material I find at the moment is https://blogs.mathworks.com/simulink/2014/01/08/simulink-and-matlab-objects/
More Answers (0)
See Also
Categories
Find more on Configure and View Diagnostics 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!