image thumbnail
axdefl.m
% Example: axdefl
% ~~~~~~~~~~~~~~~
% This program determines the deflection in
% a cantilever beam subjected to a transverse
% load, concentrated moment, and axial load
% at the free end of the beam.
%
% Data is defined in the declaration statements
% below, where:
%
% Length  - beam length
% Emod    - modulus of elasticity
% Inertia - beam inertia
% F0      - value of transverse load
% M0      - value of moment load
% P0      - value of axial load
% Npts    - number of beam nodes along beam for
%           discretization of beam
%
% User m functions required: genprint
%----------------------------------------------

clear;
Problem=1;
if Problem == 1
  %...Cantilever beam of circular cross section
  Length=10; Emod=30e6; Npts=101; 
  F0=10; M0=10; 
  Diameter=1; Inertia=pi*Diameter^4/64;
  % Axial force is 90% of the buckling load
  P0=-0.90*pi^2*Emod*Inertia/(2*Length)^2; 
end

k=sqrt(P0/(Emod*Inertia)); 
skl=sinh(k*Length); ckl=cosh(k*Length);
yend=M0/P0*(ckl-1)/ckl+ ...
     F0/P0*(Length*ckl-skl/k)/ckl;
c=F0/P0; d=yend-(M0+F0*Length)/P0; 
x=linspace(0,Length,Npts)';
skx=sinh(k*x); ckx=cosh(k*x); 
y=c*(x-skx/k)+d*(1-ckx);
moment=-Emod*Inertia*k*(c*skx+d*k*ckx);  

fprintf( ...
  '\n\nDeflection of Axially Loaded Beam');
fprintf('\n---------------------------------');
fprintf( ...
  '\n\nLength:                   %g',Length);
fprintf('\nE:                        %g',Emod);
fprintf( ...
  '\nInertia:                  %g',Inertia);
fprintf('\nF0:                       %g',F0);
fprintf('\nM0:                       %g',M0);
fprintf('\nP0:                       %g',P0);
fprintf( ...
  '\nNumber of beam nodes:     %g',Npts);
fprintf('\n\nBeam Results at Nodes:');
fprintf('\n      #       x            M     ');
fprintf('       y');
fprintf('\n    --- ------------ ------------');
fprintf(' ------------');
for i=1:length(y)
  fprintf('\n   %4.0f %12.5e %12.5e %12.5e', ...
    i,x(i),moment(i),y(i));
end
fprintf('\n');

clf;
ax=subplot(2,1,1);
  plot(x,moment,'-');
  title('Moment'); xlabel('x'); ylabel('Moment');
  drawnow;
subplot(2,1,2);
  plot(x,y,'-');
  title('Deflection');
  xlabel('x'); ylabel('Deflection');
  drawnow;
  %genprint('axdefl');

Contact us at files@mathworks.com