File Exchange

image thumbnail


version (435 KB) by Giampiero Campa
Nonlinear 6DOF Model of an Underwater Vehicle


Updated 07 Feb 2007

View License

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 "", please follow the istructions in the file "contents.m".

Giampy, Dec 2001

Comments and Ratings (7)

Hi Tom,

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.

Tom Riley

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
Caused by:
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?



pang kun

Gerardo Acosta

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.

Kulic Ranka

I wuld like to check if it is possible to apply behavioral cloning to control vehicle to avoid obstacles.

Dionnys Moran

farzin radkani


Changed info.xml file to avoid annoying messages within the last matlab versions.

Removed extra dir info from zip file,
and corrected a small bug.

Renamed everything lowercase

Updated Signature and info.xml file.

The figures in the PDF manual now have a better resolution.

MATLAB Release Compatibility
Created with R11.1
Compatible with any release
Platform Compatibility
Windows macOS Linux