Hello Samuel,
I am able to replicate the error, “Error in port widths or dimensions” arising when running the “Modeling and Simulation of an Autonomous Underwater Vehicle” example with the “High Fidelity Simulation” option enabled.
The reason for the error is that the “Marine Drag - Body axes” block present in the block path,
“asbAUV/Plant and Environment Model/Environmental Forces & Moments/Hydrodynamic Forces/Hydrodynamic Forces - Accurate/Marine Drag - Body axes”
assumes its second input, “AOA and Side Slip” to be a 3-element vector which later leads to the port width mismatch.
To resolve the issue, you can follow the below steps:
1. Open the “asbAUV” Simulink model by executing the following command in MATLAB Command Window.
openExample('aeroblks/AutonomousUnderwaterVehicleExample');
2. Toggle the switch ‘b’ to “High Fidelity Simulation”, as shown below.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1773210/image.png)
(Optional: Update the model using the keyboard shortcut “Ctrl + D” which will throw the error, “Error in port widths or dimensions”, as before.)
3. Open the “Marine Drag - Body axes” subsystem present in the block path,
“asbAUV/Plant and Environment Model/Environmental Forces & Moments/Hydrodynamic Forces/Hydrodynamic Forces - Accurate/Marine Drag - Body axes”.
4. Double click each of the “Selector” blocks indicated below and set the “Input port size” parameter to 2.
5. Run the model to ensure the error is rectified.
The following documentation provides more information on the “Selector” block.
I hope this helps you resolve the error!