Code covered by the BSD License  

Highlights from
Modeling Flexible Bodies in SimMechanics

image thumbnail
from Modeling Flexible Bodies in SimMechanics by Dallas Kennedy
Technical paper and examples on modeling flexibility in SimMechanics.

paper_generate_fea_plots
function paper_generate_fea_plots
% PAPER_GENERATE_FEA_PLOTS  Generate plots for flexible-body paper
%
% PAPER_GENERATE_FEA_PLOTS will simulate the FEA models referenced in the SimMechanics
% flexible-body white paper, and will then plot and save the results.

% Copyright 2006, The MathWorks, Inc.

[t,x,y]=sim('fea_cantilever_load',5);
paper_plot_position_data(t,y,'Signal-Loaded Cantilever (FEA model)' , 5 , 0.3 );
set(gca,'XLim',[0 0.60]);
dosave( 'paperfig_loadsignalresponse_fea' );

[t,x,y]=sim('fea_cantilever_body',30);
paper_plot_position_data(t,y,'Body-Loaded Cantilever (FEA model)' , 10 , [] )
set(gca,'XLim',[0 10]);
dosave( 'paperfig_loadbodyresponse_fea' );

[t,x,y]=sim('fea_cantilever_body_spring',30);
paper_plot_position_data(t,y,'Body-Loaded Spring-Mounted Cantilever (FEA model)', 10 , [] )
set(gca,'XLim',[0 10]);
dosave( 'paperfig_loadbodyspringresponse_fea' );

function dosave( name )
    saveas( gcf, [ name '.fig' ] ,'fig' );
    saveas( gcf, [ name '.eps' ] ,'epsc' );
    saveas( gcf, [ name '.jpg' ] ,'jpg' );
    

Contact us at files@mathworks.com