constraint

Navigation:  Language Reference > Functions > Arithmetic >

constraint

Previous pageReturn to chapter overviewNext page

Syntax

y = constraint(x);

Description

This function iteratively assigns a value to y such that x approaches zero within a given error margin. It only works in combination with the MBDF simulation method! The function is very useful for entering constraints in physical systems and inverse dynamics.

Examples

This example makes a velocity vm equal to a reference velocity vs:

 

vs = sin(time);                        // reference velocity

v = vm - vs;                                // If v = 0 then the mass follows the reference velocity

F = constraint(v);                // Make F have a value that yields a zero velocity v

vm = (1/m)*int(F);                // mass