Code covered by the BSD License  

Highlights from
Biohydrodynamics Toolbox

image thumbnail
from Biohydrodynamics Toolbox by Alexandre Munnier
Tool to simulate easily the motion of moving solids or swimming robots in a potential fluid flow.

bht_simulation page: how to make movies
bht_simulation page: how to make movies
Biohydrodynamics Toolbox    

bht_simulation


Return movie frames, captured at each time step, of the articulated bodies' motion.

Syntax

Film = bht_simulation('DataFilename',filename)
Film = bht_simulation(...,options)

Description

The function does the following:
    • it opens a figure in which are ploted, at each time step, the fluid's boundaries and the articulated bodies at the successive positions computed by the function bht_traject_compute with the data of the DAT-File filename. The colors are those specified in the DAT-File.
    • it captures a movie frame.
The function can be ran only after the articulated bodies' motion has been successfully computed by the function bht_traject_compute, for it requires the MAT-File filename_results.
You can specify the following options:
option Expected value Default value Description
axis array [xmin xmax ymin ymax]
Axis limits chosen by MATLAB at the initial simulation time
Set the limits for the x- and y-axis
CenteredOnFish integer None Center the figure on the specified fish at each time step.
Grid on or off on Display grid.
DrawCenterOfMass  LineSpec (line specification: string or cell) for MATALB lines None Draw the trajectories of the articulated bodies' center of mass using the line properties of LineSpec.
DrawFishAxis LineSpec (line specification: string or cell) for MATALB built-in function quiver None Draw the moving frames attached to the articulated bodies using the quiver properties of LineSpec.
TimeRange  array [T1 T2] Time range [0,Tmax] of the DAT-File Time range for the animation. If the time range is not within the time range of the DAT-File, the animation is empty.
DisplayTime on or off off Display a clock in the top-right corner.
DrawFishVelocity LineSpec (line specification: string or cell) for quiver. None Draw bodies' velocities vectors at the centers of mass of the bodies using quiver's properties of LineSpec. 
The statement:
 >> movie(Film,options);
replays the movie. Use the built-in MATLAB function movie2avi to turn MATLAB movies into avi movies.

Examples

The command line:
>> Film = bht_simulation('DataFilename','two_fishes','DrawCenterOfMass','--b','axis',[-10 5 -3 5],'TimeRange',[5 7], DrawFishAxis,{4,'-r','LineWidth',2},'DisplayTime','on','CenteredonFish',2,'Grid','off');
returns movie frames, captured at each time step, of the motion of the articulated bodies described in the DAT-File two_fishes. The trajectories of  the articulated bodies' center of mass are ploted with LineSpec = '--b' (dashed blue line). The x-axis limits are -10 and 5 and the y-axis limits are -3 and 5, centered on fish 2. The simulation goes from time = 5 to time = 7. The moving frames attached to the bodies are displayed with scale = 4, color = r (red) and LineWidth = 2. Eventually, a clock is displayed in the top-right corner of the pictures.

See also

bht_traject_compute
2008 - A. Munnier and B. Pincon (Insitut Elie Cartan and INRIA Lorraine, Projet CORIDA, Nancy, France).       

Contact us at files@mathworks.com