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_plot_freq_shift.m
% PAPER_PLOT_FREQ_SHIFT Compute and plot the frequency vs. load mass plot
%
% Generate data

% Copyright 2006, The MathWorks, Inc.

masses = [ 1 2 4 5 20 22 24 26 28 30 ];
data = paper_generate_freq_shift( masses , 'fea_cantilever_body' );
m=data(:,1);
T=data(:,2);
f=1./T;
omega=2*pi*f;
omega2=omega.^2;
omega2_inv = 1./omega2;

%
% Plot
%
figure;hold off;
subplot(2,1,2);plot(m,f,'r.')
subplot(2,1,1);plot(m,omega2_inv,'r.')
[p,S] = polyfit(m,omega2_inv,1)
hold on;
mp=min(m):0.01:max(m);
plot(mp,polyval(p,mp),'b-');

k=5.54e4;
M=1.35; %kg
alpha = p(2) * k / M
freefreq = sqrt( 1./p(2) ) / (2 * pi)


f2 = f.^2;
f2_inv = 1./f2;
figure;
plot(m,f2_inv,'r+'); hold on;
[p,S] = polyfit(m,f2_inv,1)
mp=min(m):0.01:max(m);
plot(mp,polyval(p,mp),'b-');
xlabel('mass [kg]');
ylabel('T_m^2 [sec]');
title('Load Mass Dependence of Oscillation Frequency')

freefreq=1/sqrt(p(2))

Contact us at files@mathworks.com