Contents     Functions         Previous Next     PDF Index



UI command function for the visualization of 3-D deformation plots


fecom CommandString


fecom provides a number of commands that can be used to manipulate 3-D deformation plots are handled by the feplot/fecom interface. A tutorial is given section 4.1. Other examples can be found in gartfe, gartte and other demos. Details on the interface architecture are given under feplot.

This help lists all commands supported by the interface (calling fecom or feplot is insensitive to the user).


These commands start to implement direct model modification in the feplot figure. Sample calls are illustrated in section 2.2.1.

Anim[,One][,Time,Freq][,col][nCycle i, Start i, Step]

Deformed structure animation. The animation is not movie based so that you can actively rotate, change mode, ... without delay. The AnimStep command is only used when you really want to create movies.

The animation is started/interrupted using the animation button which calls the anim start command. You can set animation properties in the General tab of the feplot properties figure.

To control animation speed and replay you can use fecom('AnimTime nStep tStep tStart' which specifies the number of times that you want the animation to run (0 to run continuously), the minimum time spent at each time step (default zero), and the wait time between successive runs of the same animation (default 0, only works with time mode animation). You can also use fecom('AnimTime StepInc' to define the step increment of the animation. You may need to fix the color limits manually using[0 1e3].

demosdt('demobartime'); fecom AnimeTime5;

The default animation (use of AnimFreq to return to the default) adds a certain phase shift (2*pi/nCycle) to the amplification factor of the deformations currently displayed and updates the plot. The default nCycle value is obtained using feplot AnimnCycle25.

The command AnimTime starts the animation in a mode that increments deformations while preserving the amplification. This is appropriate for animation of time responses.

By default Anim animates all the axes in the current figure. You can animate, the current axis only by adding One anywhere in the anim command.

By default Anim does not animate colors. fecom('AnimCol') sets color animation to dual sided (alternates between a max value and its opposite). You can animate colors without deformations if you define colors for the current selection without defining a deformation.

Animation speed is very dependent on the figure renderer. See the fecom Renderer command.

AnimAvi [,AnimMovie i]

Creating a movie. M=feplot('anim movie 50') returns a MATLAB movie with 50 animation steps.

Starting with MATLAB 6.0 you can use fecom('AnimAvi') to create a movie. The movie is created using avifile commands with defaults in set to sdtdef('avi'). You may change the defaults (see avifile) using for example


Compressions of None gives highest quality. Indeo3 and Indeo5 give poor results with colored patches.

caxi, ca+

Change current axes. cax i makes the axis i (an integer number) current. ca+ makes the next axis current.

For example, fecom(';sub2 1;cax1;show line;ca+;show sensor') displays a line plot in the first axis and a sensor plot in the second.

See also the Axes tab in the feplot properties figure and the iicom sub command. In particular SubStep is used to increment the deformation numbers in each subplot.

ch[,c] [i,+,-,+i,-i],

Displayed deformation control. feplot is generally used to initialize a number of deformations (as many as columns in mode). ch i selects the deformation(s) i to be displayed (for example ch 1 2 overlays deformations 1 and 2). By default the first deformation is displayed (for line and sensor plots with less than 5 deformations, all deformations are overlaid). You can also increment/decrement using the ch+ and ch- commands or the + and - keys when the current axis is a plot axis. ch+i increments by i from the current deformation.

You can also select deformations shown in the Deformations tab in the feplot properties figure.

When using more than one axis (different views or deformations), the ch commands are applied to all feplot axes while the chc commands only apply to the current axis.

The SubStep command is useful to obtain different deformations in a series of axes. Thus to display the first 4 modes of a structure you can use: fecom(';sub 1 1;ch1;sub 2 2 step') where the sub 1 1 is used to make sure that everything is reinitialized. You can then see the next four using fecom('ch+4').

For line and sensor plots and multiple channels, each deformation corresponds to an object and is given a color following the ColorOrder of the current axis is used. feplot line and sensor plots compatible with the use of setlines for line type sequences.

ColorData [,seli] [Type] [,-alphai]

Color definitions Color information is defined for element selections (see the fecom Sel commands) and should be defined with the selection using a call of the form, cf.sel(i)={'SelectionString','ColorData', ...}. fecom('colordata seli ...',...) is the corresponding low level call. See also fecom ColorBar and fecom ColorLegend commands.

Accepted options for the command are

Accepted ColorData commands are listed below

x, y, z, all,DOFfecom('ColorDataZ') defines a color that is proportional to motion in the z direction, ... ColorData19 will select DOF 19 (pressure). The color animation mode is set to ScaleColorDef. fecom('ColorDataALL') defines a color that is proportional to motion norm.
Enerfecom('ColorData EnerK') calls fe_stress to compute the strain energy for the elements in the current selection and deformation set and displays the result as element colors. EnerM computes the kinetic energy. The color animation mode is set to ScaleColorOne. This requires material and element properties to be defined InitModel.
 fecom('ColorData -bygroup') sums the contribution of elements within a group fecom('ColorData -bygroup-frac') divides the result by the total energy equal to the square of the modal frequency for normal modes. Similarly -byProId and -byMatId group by property identifier.
Group, Mat, Pro, ifecom('ColorDataGroup') defines a color for each element group, Mat for each MatId, and Pro for each ProId. ColorDataI gives a color for each separate triplet. A color map can be given as a second argument.
 ColorData Group -edge affects colors to nodes rather than surfaces and displays a colored wire-frame.
 The color animation mode is set to ScaleColorOne.
Stressthe ColordataStress i command defines the selection color by calling fe_stress with command Stressi. The color animation mode is set to ScaleColorOne. This requires material and element properties to be defined with InitModel.

Uniformin this mode the deformation/object index is used to define a uniform color following the axis ColorOrder.
EltThe low level call fecom('ColorDataElt',Ener,IndInElt) specifies element colors in Ener and with IndInElt row positions in the global element description matrix of the given colors. A typical application is the case of energies with fe_stress (see the d_ubeam demo). If Ener gives the color for all elements, you can omit IndInElt. You can also provide Ener as a struct with fields .data .IndInElt, or .data .EltId.
Nodelow level call to set a color defined at nodes fecom('ColorData',cmode) where cmode is a size(node,1) by size(mode,2) matrix defining nodal colors for each deformation (these are assumed to be consistent with the current deformation set). Values are scaled, see the ScaleColor command. fecom('ColorDataNode',mode,mdof) defines nodal colors that are proportional to the norm of the nodal displacement. You can obtain nodal colors linked to the displacement in a particular direction using i1=fe_c(mdof,.03,'ind');fecom('ColorDataNode', md0(i1,:), mdof(i1)) even though for displacements in the xyz directions fecom('ColorDataZ') is shorter.

Note: When displaying results colors are sometimes scaled using the amplification factor used for deformations. Thus, to obtain color values that match your input exactly, you must use the fecom ScaleColorOne mode. In some animations you may need to fix the color limits manually using[0 1e3].

Color [,seli] [Edge ..., Face ..., Legend]

Default EdgeColor and FaceColor properties of the different patches can be set to none, interp, flat, white, ... using fecom('ColorEdgeNone'), ...

fecom('ColorEdge',ColorSpec) where ColorSpec is any valid MATLAB color specification, is also acceptable.

EdgeColor and FaceColor apply to the current selection. The optional Seli argument can be used to change the current selection before applying the command.

You can also modify the properties of a particular object using calls of the form set(cf.o(i),'edgecolor',ColorSpec) (see fecom go commands and illustrations in gartte).

fecom('ColorLegend') uses the MATLAB legend command to create a legend for group, material or property colors. Of course, the associated selection must have such colors defined with a Colordata[M,P,G] command.


fecom('colorbar') calls the MATLAB colorbar to display a color scale to the left of the figure. feplot updates this scale when you change the deformation shown. Custom displays are handled by specifying the corresponding fields as further arguments in the format fecom('colorbar','CustomField',NewVal,...), where CustomField is a standard colorbar field, and NewVal the custom value to set. Use fecom ColorBarOff to reinitialize a subplot without a color bar.

In the following example, one plots the actual z displacement of the Garteur demo using a custom colorbar.

fecom('colordataEvalZ -edgealpha .1')
% Disp in CM (*100), 2sided ([-cmax cmax]), instant (updated scale)
fecom('ColorScale Unit 100 2Sided Instant');
fecom('colorbar', ...
    'units','normalized','position',[.88 .5 .04 .4], ...
    'YAxisLocation','left','FontSize',12, ...


fecom ColorAlpha starts a specific coloring mode where the transparency is indexed on the colormap level. This can be used to highlight high strain areas in volume models. -EdgeAlpha val may be used to make the edges transparent.

Uniform tranparency of faces and edges is obtained using the FaceEdgeAlpha entry in the object context menu or with a command of the form below.

 d_ubeam; cf=feplot;
 % Use Value based alpha and Set the edges to be 10% transparent
 fecom('ColorAlpha -edgealpha .1');


Once colors defined with fecom ColorData, multiple scaling modes are supported. For calling examples, see fecom ColorBar. The modes are accessible through the feplot:Anim menu.


If a time deformation is defined in the feplot figure, one can see time curve at a specific node using fecom CursorNodeIiplot command. A node cursor then appears on the feplot displayed model, and clicking on a node shows corresponding curve in the iiplot figure. Reciprocally one can show a cursor on the iiplot curve to show corresponding time deformation in feplot using iicom CursorOnFeplot command. Note that this functionality should only be used for small models.

Following example let you test this functionality.

model=femesh('testhexa8'); cf=feplot(model); model=cf.mdl; % simple cube
data=struct('def',[1 1 1 1]','DOF',[5 6 7 8]'+.03,...
    'curve',fe_curve('test sin 10e-2 5000 1 5000e-4'));
model=fe_case(model,'DofLoad','topload',data); % sin load
model=fe_case(model,'FixDof','basefix','z==0'); % fix base
model=fe_time('timeopt newmark .25 .5 0 1e-4 5000',model); % time computation
cf.def=fe_time(model); % show time animation
fecom CursorNodeIiplot % display cursor on feplot
ci=iiplot;iicom(ci,'ch',{'NodeId',5}) % Test the callback

iicom CursorOnFeplot   %  display cursor on iiplot

% Cursor following animation
fecom(sprintf('AnimCursor%i Start100',ci.opt(1)))

ga i

fecom('ga i') or gets pointers to the associated axes. See details under the same iicom command. A typical application would be to set multiple axes to the same view using iimouse('view3',

go i

Get handles to fecom objects. This provides and easy mechanism to modify MATLAB properties of selected objects in the plot (see also the set command).

For example, set(fecom('go2'),'linewidth',2) will use thick lines for feplot object 2 (in the current feplot axis).

You will probably find easier to use calls of the form cf=feplot (to get a handle to the current feplot figure) followed by set (cf.o(2),'linewidth',2). If the feplot object is associated to more than one MATLAB object (as for text, mixed plate/beam, ...) you can access separate pointers using cf.o(2,1). The gartte demo gives examples of how to use these commands.

Head [,freq, po, fs]

Set header strings for automated title generation. fecom ('head',Labels), where Labels should be a string matrix or a cell array of string, can be used to associate a title string to each deformation of the current deformation set.

fecom('head') defines default strings. fecom('headfreq',freq) creates strings of the form Mode 1 at 100Hz. fecom('headfs',freq) gives strings of the form 1 @ 100. fecom('headpo',po) gives for poles strings of the form 6.5 Hz 1.00 % .

fecom('TitOpt111') turns automatic titles on (see iicom). fecom('TitOpt0') turns them off.

Note that the iicom head commands can be used to place additional titles in the figure. cf.head returns a pointer to the header axis. Mode titles are actually placed in the header axis in order to bypass inappropriate placement by MATLAB when you rotate/animate deformations.


Displays information about the declared structure and the objects of the current plot in the command window. This info is also returned when displaying the SDT handle pointing to the feplot figure. Thus cf=feplot returns

 cf = 
   FEPLOT in figure 2
     Selections: cf.sel(1)='groupall';
                 cf.sel(2)='WithNode {x>.5}';
   Deformations: [ {816x20} ]
   Sensor Sets: [ 0 (current 1)]
   Axis 3 objects:
    cf.o(1)='sel 2 def 1 ch 9 ty1'; % mesh
    cf.o(2) % title

which tells what data arrays are currently defined and lists feplot objects in the current axis. fecom('pro') opens the feplot properties figure which provides an interactive GUI for feplot manipulations.

InitDef[ , Back]

Initialization of deformations. You can (re)declare deformations at any point using cf.def(i)=def. Where cf a SDT handle to the figure of interest and i the deformation set you which to modify (if only one is defined, cf.def is sufficient). Acceptable forms to specify the deformation are

feplot(cf,'InitDef',data) is an alternate calling format that defines the current deformation. InitDef updates all axes. InitDefBack returns without updating plots.

load, InitModel

Initialization of structure characteristics. The preferred calling format is
cf.model=model where the fields of model are described in section 7.6. This makes sure that all model information is stored in the feplot figure. cf.mdl then provides a handle that lets you modify model properties in scripts without calling InitModel again.

Lower level calls are cf.model={node,elt,bas}
(or feplot('InitModel' ,node,elt,bas) (see basis for bas format information). InitModelBack does not update the plot (you may want to use this when changing model before redefining new deformations).

The command is also called when using femesh plotelt, or upcom plotelt (which is equivalent to cf.model=Up). Note that cf.model=UFS(1) for a data stack resulting from ufread and cf.model=Up for type 3 superelement.

Load from file fecom('Load','FileName') will load the model from a binary FileName.mat file. fecom('FileImportInfo') lists supported import formats.

fecom('Load-Back',FileName) is used to load, but not display the model (this is used for very large model reading).

fecom('Load-Hdf','FileName') loads a model from a HDF5 .mat file but retains most data at v_handle pointers to the file.


Initialization of sensors. You can declare sensors independently of the degrees of freedom used to define deformations (this is in particular useful to show measurement sensors while using modeshape expansion for deformations). Sensor and arrow object show the sensor sets declared using initsens.

Translation sensors in global coordinates can be declared using a DOF definition vector cf.sens(i)={mdof} or feplot('initsens',mdof). In the first calling format, the current sensor set is first set to i.

Sensors in other directions are declared by replacing mdof by a 5 column matrix following the format

   SensorId  NodeId  nx ny nz

with SensorId an arbitrary identifier (often 101.99 for sensor of unknown type at node 101), NodeId the node number of the sensor position, [nx ny nz] a unit vector giving the sensor direction in global coordinates (see section 3.1).

fe_sens provides additional tools to manipulate sensors in arbitrary directions. Examples are given in the gartte demo.


feplot('plot'), the same as feplot without argument, refreshes axes of the current figure. If refreshing the current axis results in an error (which may occasionally happen if you modify the plot externally), use clf;iicom('sub') which will check the consistency of objects declared in each axis. Note that this will delete Text objects as well as objects created using the SetObject command.


feplot('pro') initializes or refreshes the feplot property GUI. You can also use the Edit:Feplot Properties ... menu. A description of this GUI is made in section 4.1.

feplot('ProViewOn') turns entry viewing on.


This command can be used to switch the renderer used by feplot. Animation speed is very dependent on the figure renderer. When creating the figure fecom tries to guess the proper renderer to use (painters, zbuffer, opengl), but you may want to change it (using the Feplot:Render menu or set(gcf,'renderer', 'painters'), ...). painters is still good for wire frame views, zbuffer has very few bugs but is very slow on some platforms, opengl is generally fastest but still has some significant rendering bugs on UNIX platforms.

To avoid crashes when opening feplot in OpenGL mode use cingui('Renderer zbuffer default') in your MATLAB startup file.

Save, FileExport

Save the model to a .mat file or export it to supported formats.
fecom('FileExportInfo') lists supported export formats.

fecom('Save -savesel file.mat' also saves the selection(s) which allows faster reload of large models. fecom('Save -savedef file.mat' also saves the deformations(s).

Scale [ ,Defs, Dofi, equal, match, max, one]

Automatic deformation scaling. Scaling of deformations is the use of an amplification factor very often needed to actually see anything. A deformation scaling coefficient is associated with each deformed object. The Scale commands let you modify all objects of the current axis as a group.

You can specify either a length associated with the maximum amplitude or the scaling coefficient.

The base coefficient scc for this amplification is set using fecom('ScaleCoef scc'), while fecom('ScaleDef scd') sets the target length. fecom('scd 0.01') is an accepted shortcut. If scd is zero an automatic amplitude is used. You can also modify the scaling deformation using the l or L keys (see iimouse).

fecom supports various scaling modes summarized in the table below. You can set this modes with fecom('scalemax') ... commands.

Scaling modeScaling of 1st deformationScaling of other deformations
maxAmplitude of Max DOF set to scd.Amplitude of Max DOF set to scd.
equalAmplitude of Max DOF set to scd.Amplitude of other deformations equal to the first one
matchAmplitude of Max DOF set to scd.Amplitude of other deformations set to optimize superposition. When using two deformation sets, rather than two modes in the same set, their DOFs must be compatible.
coefDeformation amplitude multiplied by scd.Same as first deformation.
oneSets scd to 1 and uses coef mode (so further changes to scd lead to amplification that is not equal to 1).Same as first deformation.

Warning : using ScaleMax or AnimFreq can lead to negative or complex amplification factors which only makes sense for frequency domain shapes.
fecom('scalecoef') will come back to positive amplification of each object in the current feplot axis.

ScaleDofi is used to force the scaling DOF to be i. As usual, accepted values for i are of the form NodeId.DofId (1.03 for example). If i is zero or not a valid DOF number an automatic selection is performed. ScaleDof can only be used with a single deformation set.

You can change the scale mode using the FEplot:Scale menu or in the Axes tab of the feplot properties figure.

Sel [ElementSelectors, GroupAll, Reset]

Selection of displayed elements. What elements are to be displayed in a given object is based on the definition of a selection (see section 7.12).

The default command is 'GroupAll' which selects all elements of all element groups (see section 7.2 for details on model description matrices). cf.sel(1)='Group1 3:5' will select groups 1, 3, 4 and 5. cf.sel(1)='Group1 & ProId 2 & WithNode {x>0}' would be a more complex selection example.

To define other properties associated with the selection (fecom ColorData in particular), use a call of the form cf.sel(i)={'SelectionString','OtherProp',OtherPropData}.

To return to the default selection use fecom('SelReset').

fecom('Sel ... -linface') can be used to generate first order faces for second order elements, which allows faster animation.

SetObject i [,ty j] [,def k] [,ch k] [,sel s, sen s]

Set properties of object i. Plots generated by feplot are composed of a number of objects. 1 (surface view), 2 (wire frame view), 3 (stick view of sensors), 4 (undeformed structure), 5 (node text labels), 6 (DOF text labels), 7 (arrow view of sensors). A printout of objects existing in the current plot and their properties is given when displaying the SDT handle associated to the feplot figure (using cf=feplot;disp(cf)).

The SetObject command lets you modify these properties and add/remove new objects. Objects are added if the object number does not exist and removed if the declared object type is zero (j=0).

The deformation number k is an index in the deformation(s) currently selected for the plot using the fecom ch.

The elements actually displayed can be specified by giving an existing selection number s. For sensor objects, you can specify the sensor set with sen s if you don't want to use the current one.

The current axis summary obtained with cf=feplot gives the preferred calling format cf.o(i)='SetObjArgs' where you give a string with the options associated to the SetObject command. The use of these commands is illustrated in the gartte demo. Note that you can use the call, to set other MATLAB properties of the created objects. cf.o(1)={'ty2 def1 ch1 sel1','linewidth',2,'edgecolor','r'} will, for example, create a wire-frame object using thick red lines.

Show [patch,line,sensor,arrow, ...]

Basic plots are easily created using the show commands which are available in the FEplot:Show ... menu).

patchsurface view with hidden face removal and possible color coding (initialized by fecom('ShowPatch')). cf.o(1) object type is 1. For color coding, see colordata commands.
linewire frame plot of the deformed structure (initialized by fecom('ShowLine')). cf.o(2) object type is 2.
sensSensor plots with sticks at sensor locations in the direction and with the amplitude of the response (initialized by fecom('ShowSen')). cf.o(2) object type is 3.
arrowSensor plots with arrows at sensor locations in the direction and with the amplitude of the response (initialized by fecom('ShowArrow')). cf.o(2) object type is 7.
DefArrowDeformation plots with lines connecting the deformed and undeformed node positions. (initialized by fecom('ShowDef')). cf.o(2) object type is 8.
Baslenshows triaxes centered a the position of each local basis. The length of the triax arrow is specified by len.
FEMonly shows FEM element groups for models mixing test and FEM information
testonly shows test element groups for models mixing test and FEM information
linksshows a standard plot with the test and FEM meshes as well as links used for topological correlation (see fe_sens).
mapfecom('ShowMap',MAP) displays the vector map specified in MAP (see feutil GetNormalMap). Nota : to see the real orientation, use the fecom('scaleone'); instruction. fecom('ShowUndef',MAP) also displays the underlying structure. MAP can also be an element selection, as in the example below demosdt('demogartfeplot');fecom('ShowMap','EltName quad4')
NodeMarkfecom('shownodemark',1:10,'color','r','marker','o') displays the node positions of given NodeId (here 1 to 10) as a line. Here a series of red points with a o marker. You can also display positions with fecom('shownodemark',[x y z],'marker','x'). Command option -noclear allows to overlay several shownodemark plots, e.g. to show two distinct sets of nodes with different colors at once.
Trajfecom('ShowTraj',(1:10)') displays the trajectories of the node of NodeIds 1 to 10 for current deformation. Command option -axis is used to display axis node trajectories.
2defis used for cases where you want to compare two deformations sets. The first two objects only differ but the deformation set they point to (1 and 2 respectively). A typical call would be cf.def(1)={md1,mdof,f1}; cf.def(2)={md2,mdof,f2}; fecom('show2def').

Once the basic plot created, you can add other objects or modify the current list using the Text and SetObject commands.

Sub [i j ], SubIso, SubStep

Drawing figure subdivision (see iicom for more details). This lets you draw more than one view of the same structure in different axes. In particular the SubIso command gives you four different views of the same structure/deformation.

SubStep or Sub i j Step increments the deformation shown in each subplot. This command is useful to show various modeshapes in the same figure. Depending on the initial state of the figure, you may have to first set all axes to the same channel. Use fecom('ch1;sub 2 2 step') for example.

Text [off, Node [,Select], Dof d]

Node/DOF text display. TextOff removes all text objects from the current feplot axis. TextNode displays the numbers of the nodes in FEnode. You can display only certain node numbers by a node selection command Select. Or giving node numbers in fecom('textnode',i). Text properties can be given as extract arguments, for example fecom('textnode',i,'FontSize',12,'Color','r').

TextDOF displays the sensor node and direction for the current sensor

TextDOF Name displays sensor labels of a cf.CStack{'Name'} SenDof entry. Additional arguments can be used to modify the text properties. fecom('textdof') displays text linked to currently declared sensors, see feplot InitSens command (note that this command is being replaced by the use of SensDof entries).

TitOpt [ ,c] i

Automated title/label generation options. TitOpt i sets title options for all axes to the value i. i is a three digit number with units corresponding to title, decades to xlabel and hundreds to ylabel. By adding a c after the command (TitOptC 111 for example), the choice is only applied to the current axis.

The actual meaning of options depends on the plot function (see iiplot). For feplot, titles are shown for a non zero title option and not shown otherwise. Title strings for feplot axes are defined using the fecom head command.

Triax [ , On, Off]

Orientation triax. Orientation of the plotting axis is shown using a small triax. Triax initializes the triax axis or updates its orientation. TriaxOff deletes the triax axis (in some plots you do not want it to show). Each triax is associated to a given axis and follows its orientation. The triax is initially positioned at the lower left corner of the axis but you drag it with your mouse.

Finally can use fecom('triaxc') to generate a triax in a single active subplot.

Undef [ , Dot, Line, None]

Undeformed structure appearance. The undeformed structure is shown as a line which is made visible/invisible using UnDef (UnDefNone forces an invisible mesh). When visible, the line can show the node locations (use UnDefDot) or link nodes with dotted lines (use UnDefLine).

View [...]

Orientation control. See iimouse view.

See also

feplot, fe_exp, feutil

©1991-2011 by SDTools
Previous Up Next