Code covered by the BSD License  

Highlights from
Modeling Flexible Bodies in SimMechanics

image thumbnail

Modeling Flexible Bodies in SimMechanics

by

 

08 May 2006 (Updated )

Technical paper and examples on modeling flexibility in SimMechanics.

Editor's Notes:

The download problems reported in the comments have been addressed. The zip file now downloads properly.

paper_generate_freq_shift( masses , modelName )
function data = paper_generate_freq_shift( masses , modelName )
% PAPER_GENERATE_FREQ_SHIFT Will compute the period for a series of masses
%
% DATA = POWER_GENERATE_FREQ_SHIFT( MASSES , MODELNAME )

%  MASSES contains a list of load mass values to use when simulating
%  MODELNAME. The model must refer to a variable loadMass to hold the value of
%  the load mass.  
%
%  DATA is returned as a matrix with a row for each mass value. The format of
%  each row is [ mass period ]

% Copyright 2006, The MathWorks, Inc.
    
open( modelName );
savedLoadMass = evalin( 'base' , 'loadMass' );

whichTime = 10;

data = zeros( [ 0 2 ] );
for loadMass = masses
    assignin( 'base' , 'loadMass' , loadMass );
    [ t , x , y ] = sim( modelName );
    y=y( : , 2 );
    [ T ] = paper_calculate_period( t , y , whichTime );
    data( end+1 , : ) = [ loadMass , T ];
end

assignin( 'base' , 'loadMass' , savedLoadMass );

    

Contact us