Hello,
As far as changing the example to work with 5 elements, it looks like the data for the example gets initialized in a couple of the Model Callbacks. These callbacks are Matlab code that gets called in different parts of the Simulink model lifecycle. You can find more information on Model Callbacks here:
Specifically, if you open the Model Properties and navigate to the Callbacks tab, it looks like the setup happens in PreLoadFcn and InitFcn. You will need to update this for 5 antennas instead of 10. You will probably also need to make other modifications depending on the operating frequency of your system, array geometry, PRF, etc.
For example, the existing PreLoadFcn is:
prop_speed = physconst('LightSpeed');
paramBeamformer.propSpeed = prop_speed;
paramBeamformer.Antenna = phased.ULA('NumElements',10,'ElementSpacing',0.5*lambda);
paramBeamformer.fs = 1000;
paramBeamformer.prf = 1/.3;
EleSpacing = (paramBeamformer.propSpeed/paramBeamformer.fc)/2;
SpeedofProp = paramBeamformer.propSpeed;
SamplingFreq = paramBeamformer.fc;
y_spacing = ([1:10] - 5.5).*EleSpacing;
Something like the following changes will be required for you, there may be more changes required, this will require your investigation:
prop_speed = physconst('LightSpeed');
paramBeamformer.propSpeed = prop_speed;
paramBeamformer.numElements = 5;
paramBeamformer.eleSpacing = 0.5*lambda;
paramBeamformer.Antenna = phased.ULA('NumElements',paramBeamformer.numElements,'ElementSpacing',paramBeamformer.eleSpacing);
paramBeamformer.fs = 1000;
paramBeamformer.prf = 1/.3;
EleSpacing = paramBeamformer.eleSpacing;
SpeedofProp = paramBeamformer.propSpeed;
SamplingFreq = paramBeamformer.fc;
y_spacing = ([1:paramBeamformer.numElements] - (paramBeamformer.numElements+1)/2).*paramBeamformer.eleSpacing;
Similarly, you might need to update the InitFcn:
EleSpacing = (paramBeamformer.propSpeed/paramBeamformer.fc)/2;
SpeedofProp = paramBeamformer.propSpeed;
SamplingFreq = paramBeamformer.fc;
y_spacing = ([1:10] - 5.5).*EleSpacing;
to
EleSpacing = paramBeamformer.eleSpacing;
SpeedofProp = paramBeamformer.propSpeed;
SamplingFreq = paramBeamformer.fc;
y_spacing = ([1:paramBeamformer.numElements] - (paramBeamformer.numElements+1)/2).*paramBeamformer.eleSpacing;
So those changes are pretty straightforward. However, to update the Simulink model blocks is going to be more difficult, this gets to the second part of your question. Essentially, it looks like the beamforming algorithm is just reimplemented using Simulink blocks that support HDL Code generation, so different delays are inserted into each channel to shift the phase of the sample accordingly. You will need to at least make the following updates to the model, maybe more:
- Update the concatenation in HDL Algorithm/Angle2SteeringVec/Calculate Delay/getElemPos so that both constants are zeros(1,5) instead of zeros(1,10).
- In HDL Algorithm/MAC, there is an assumption that there are 10 receive channels. You will need to update this model with your 5 element assumption. So it looks like you would change the number of outputs from the Demux blocks from 10 to 5, and remove some of the delay line blocks accordingly.
- Etc.
You will basically need to keep updating the model like in steps 1 and 2 until all of the 10 element assumptions are gone. This might be somewhat tricky, but hopefully this gets you started, feel free to post again if you run into any issues.