Shark is a detailed nonlinear model of an underwater vehicle for MATLAB 5.3 and later (tested on 6.1 as well).
It has a Simulink interface but the source code consists in 10 MATLAB functions, each one being well documented in an enclosed PDF report.
It is possible to modify the functions to simulate different kind of vehicles and, in general, this tool can be seen as an effective way to map the equations of a mechanical system to a working simulation in the MATLAB and
Simulink environment, especially in those cases where the extensive use of a matrix-based formulation in the modeling makes MATLAB (rather than Simulink) the preferred coding environment.
NOTE: After downloading and unzipping the file "shark.zip", please follow the istructions in the file "contents.m".
Giampy, Dec 2001
Giampiero Campa (2020). Shark (https://www.mathworks.com/matlabcentral/fileexchange/1207-shark), MATLAB Central File Exchange. Retrieved .
1) Make sure that both the Shark and the Source folders are in the path (and that other folders like mex5 or mex6 are NOT).
2) Change the file names rpy2j.m to rpy2J.m and rpy2r_eb.m to rpy2R_eb.m
That worked for me.
I followed the instruction in Contents and used the command: shark;nlksf
I then double clicked Load Data then pressed the run button and got the following error:
An error occurred while running the simulation and the simulation was terminated
Error due to multiple causes.
Undefined function or variable 'vxdot'.
Error in 'nlksf/Vxdot' while evaluating expression.
Do you have any ideas why this is happening?
There is a problem in the computation of the yaw angle: when computing the tg yaw=Deltay/Deltax, the sign of Deltay is wrong. Then when the yaw goes from 360º to 0º or vice-versa, there is a sudden change in the speed sign, yielding the strange shape of a cardioid in the trajectory (seen from top) instead of a circle when the rudder is fixed with a constant angle.
I wuld like to check if it is possible to apply behavioral cloning to control vehicle to avoid obstacles.
Changed info.xml file to avoid annoying messages within the last matlab versions.
Removed extra dir info from zip file,
Renamed everything lowercase
Updated Signature and info.xml file.
The figures in the PDF manual now have a better resolution.