coder.extrinsic error! Radar designing
3 views (last 30 days)
Show older comments
Hassam Mahmood
on 5 Oct 2016
Commented: Hassam Mahmood
on 8 Oct 2016
I am scanning an area from 0 to 45 degrees Azimuth using simulink blocks for FMCW radar. I used function block to write the code as was mentioned in radar scan example. The output of coder.extrinsic of phased.Radiator is mxarray and when I tried to assign it as follows I get an error " MATLAB expression 'phased.Radiator' is not of the correct class: expected 'struct', found 'phased.Radiator'". I preinitialized it already also. Same is the case with ant_array
coder.extrinsic('Phased.CosineAntennaElement','phased.Radiator','phased.URA');
sCos=phased.CosineAntennaElement('FrequencyRange', [35.5e9 36.5e9]);
hradiator=struct('Sensor', zeros(30), 'OperatingFrequency', fc);
hradiator=phased.Radiator('Sensor',sCos,'OperatingFrequency',fc);
ant_array = phased.URA('Element',sCos,'Size',[30 30],'ElementSpacing',[lambda/2, lambda/2]);
hradiator.Sensor = ant_array;
0 Comments
Accepted Answer
Honglei Chen
on 5 Oct 2016
coder.extrinsic should have no effect in regular MATLAB. It only applicable when you try to generate the code. But I'm not sure what you are trying to achieve here. Once you are in codegen mode, if you set hradiator to struct and later assign a phased.Radiator class to it, then it is expected to error out because you now changed the type of hradiator.
HTH
5 Comments
Honglei Chen
on 6 Oct 2016
I looked at your model but right now I don't have time to modify it. For the Phased Array System Toolbox, there is almost a 1-1 mapping between MATLAB and Simulink. In my opinion you are just trying to do the phased.Radiator in your MATLAB Function block and the corresponding block that you can use to represent the radiator is the Narrwoband Transmit Array block.
https://www.mathworks.com/help/phased/ref/narrowbandtransmitarray.html
You can then see how things are implemented in MATLAB to connect the blocks. If you need to compute the angle, you can use the Range Angle Calculator
https://www.mathworks.com/help/phased/ref/rangeanglecalculator.html
You may need to use phased.SteeringVector in MATLAB Function block to compute the steering vector though.
HTH
More Answers (0)
See Also
Categories
Find more on Signal Radiation, Collection, and Reflection in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!