image thumbnail
[V,M,EItheta,EIdelta,left_react, ...
function [V,M,EItheta,EIdelta,left_react, ...
  right_react]=truebeam(Problem,L,x)
%
% [V,M,EItheta,EIdelta,left_react, ...
%   right_react]=truebeam(Problem,L,x)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% This function returns the true values for 
% V, M, EItheta, EIdelta, and reactions for
% the problem indicated by the parameter 
% Problem.
%
% Problem     - integer specification 
%               indicating which problem
% L           - beam length
% x           - vector of equally spaced
%               points along beam at which
%               to calculate results
%
% V           - vector of shear values at x
% M           - vector of moment values at x
% EItheta     - vector of rotations at x
% EIdelta     - vector of deflections at x
% left_react  - reaction at left pin
% right_react - reaction at right pin
%
% User m functions called:  none.
%----------------------------------------------

[no_defl_pts]=length(x);
%..............................
%...Example with multiple loads
%..............................
if Problem == 1 
  left_react=193.75; right_react=1906.25;
  Ctheta=1848855; Cv=left_react;
  V(1)=left_react; M(1)=0;
  EItheta(1)=Ctheta; EIdelta(1)=0;
  for i=2:no_defl_pts
    xi=x(i);
    Vi=-50*xi+Cv; Mi=-25*xi^2+Cv*xi;
    EIthetai=-(50/6)*xi^3+(Cv/2)*xi^2+Ctheta;
    EIdeltai=-(50/24)*xi^4+ ...
              (Cv/6)*xi^3+Ctheta*xi;
    if (xi-36) > 0 
      Vi=Vi+50*xi; Mi=Mi+(50/2)*(xi-36)^2;
      EIthetai=EIthetai+(50/6)*(xi-36)^3;
      EIdeltai=EIdeltai+(50/24)*(xi-36)^4;
    end
    if (xi-60) > 0
      Vi=Vi+2400; Mi=Mi+2400*(xi-60);
      EIthetai=EIthetai+(2400/2)*(xi-60)^2;
      EIdeltai=EIdeltai+(2400/6)*(xi-60)^3;
    end
    if (xi-96) > 0
      Mi=Mi+24000;
      EIthetai=EIthetai+(24000)*(xi-96);
      EIdeltai=EIdeltai+(24000/2)*(xi-96)^2;
    end
    if (xi-120) > 0
      Vi=Vi-(75/(72*2))*(xi-120)^2;
      Mi=Mi-(75/(72*6))*(xi-120)^3;
      EIthetai=EIthetai- ...
               (75/(72*24))*(xi-120)^4;
      EIdeltai=EIdeltai- ...
               (75/(72*120))*(xi-120)^5;
    end
    V(i)=Vi; M(i)=Mi; 
    EItheta(i)=EIthetai; EIdelta(i)=EIdeltai;
  end
  V(no_defl_pts)=-right_react;
  M(no_defl_pts)=0; EIdelta(no_defl_pts)=0;

%.............................................
%...Constant distributed load over entire beam
%.............................................
elseif Problem == 2
  left_react=600; right_react=600;
  Cv=left_react; Ctheta=-720000;
  V=-10*x+Cv; M=-(10/2)*x.^2+Cv*x;
  EItheta=-(10/6)*x.^3+(Cv/2)*x.^2+Ctheta;
  EIdelta=-(10/24)*x.^4+(Cv/6)*x.^3+Ctheta*x;
  V(no_defl_pts)=-right_react;
  M(no_defl_pts)=0;
  EItheta(no_defl_pts)=-Ctheta;
  EIdelta(no_defl_pts)=0;

%.............................................
%...Linearly distributed load over entire beam
%.............................................
elseif Problem == 3
  left_react=1/6*1/2*L^2; 
  right_react=1/3*1/2*L^2;
  Cv=left_react; Ctheta=-(7/360)*1/2*L^4;
  V=-0.5/2*x.^2+Cv;
  M=-0.5/6*x.^3+Cv*x;
  EItheta=-0.5/24*x.^4+Cv/2*x.^2+Ctheta;
  EIdelta=-0.5/120*x.^5+Cv/6*x.^3+Ctheta*x;
  V(no_defl_pts)=-right_react;
  M(no_defl_pts)=0; EIdelta(no_defl_pts)=0;
end

Contact us at files@mathworks.com