Professional Documents
Culture Documents
% Example: vdb
% ~~~~~~~~~~~~
%
% This program calculates the shear moment
% slope and deflection of a variable depth
% indeterminate beam subjected to complex
% loading and general end conditions. The
% input data are defined in the program
% statements below.
%
% User m functions required:
% bmvardep extload lintrp oneovrei
% sngf trapsum
% more on
% Output results
disp(' ');
disp(['Solution time was 'num2str(t)' secs.']);
if NoIntSup > 0
fprintf('\nReactions at Internal Supports:');
fprintf('\n | X-location Reaction');
fprintf('\n | ------------ ------------');
for i=NoIntSup
fprintf('\n | %12.8g %12.4e',IntSup(i2)Reactions(i));
end
end
fprintf('\n\nTable of Results:');
fprintf('\n | X-location Shear');
fprintf(' Moment');
fprintf(' Theta Delta');
fprintf('\n | ----------- ------------ ');
fprintf('------------');
fprintf(' ------------ ------------');
if Printout > 0
for i=Printout:NoSegs
fprintf('\n |%12.4g %12.4e %12.4e' ...
x(i)V(i)M(i));
fprintf(' %12.4e %12.4e'Theta(i)Delta(i));
end
disp(' ');
else
i=1; j=NoSegs;
fprintf('\n |%12.4g %12.4e %12.4e' ...
x(i)V(i)M(i));
fprintf(' %12.4e %12.4e'Theta(i)Delta(i));
fprintf('\n |%12.8g %12.4e %12.4e' ...
x(j)V(j)M(j));
fprintf(' %12.4e %12.4e'Theta(j)Delta(j));
end
fprintf('\n\n');
subplot(1);
plot(xV'k-'); grid; xlabel('x axis');
ylabel('Shear'); title('Shear Diagram');
subplot(2);
plot(xM'k-'); grid; xlabel('x axis');
ylabel('Moment'); title('Moment Diagram')
subplot(3);
plot(xTheta'k-'); grid; xlabel('x axis');
ylabel('Slope'); title('Slope Curve');
subplot(4);
plot(xDelta'k-'); grid; xlabel('y axis');
ylabel('Deflection');
title('Deflection Curve'); subplot
drawnow; figure(gcf)
%print -deps vdb
% more off
%=============================================
%=============================================
nf=size(Force1); nr=size(ExtRamp1);
nx=length(x); V=zeros(nx1); M=V;
EITheta=V; EIDelta=V;
% Concentrated load contributions
if nf > 0
F=Force(:1); f=Force(:2); V=V+sngf(xf0)*F;
M=M+sngf(xf1)*F;
if nargout > 2
EITheta=EITheta+sngf(xf2)*(F/2);
EIDelta=EIDelta+sngf(xf3)*(F/6);
end
end
% Ramp load contributions
if nr > 0
P=ExtRamp(:1); Q=ExtRamp(:2);
p=ExtRamp(:3); q=ExtRamp(:4);
S=(Q-P)./(q-p); sp2=sngf(xp2);
sq2=sngf(xq2); sp3=sngf(xp3);
sq3=sngf(xq3); sp4=sngf(xp4);
sq4=sngf(xq4);
V=V+sngf(xp1)*P-sngf(xq1)* ... % Shear
Q+(sp2-sq2)*(S/2);
M=M+sp2*(P/2)-sq2*(Q/2)+ ... % Moment
(sp3-sq3)*(S/6);
if nargout > 2
EITheta=EITheta+sp3*(P/6)- ... % EI*Theta
sq3*(Q/6)+(sp4-sq4)*(S/24);
EIDelta=EIDelta+sp4*(P/24)- ... % EI*Delta
sq4*(Q/24)+(sngf(xp5)- ...
sngf(xq5))*(S/120);
end
end
%=============================================
function val=oneovrei(xEIdataBeamProp)
% [val]=oneovrei(xEIdataBeamProp)
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
% This function computes 1/EI by piecewise
% linear interpolation through a set of data
% values.
%
% x - location along beam
% EIdata - EI or depth values
% BeamProp - null or width values
%
% val - computed value for 1/EI
%
% User m functions required: none
%----------------------------------------------
%=============================================
function y=sngf(xxn)
% y=sngf(xxn)
% ~~~~~~~~~~~~~~
%
% This function computes the singularity
% function defined by
% y=<x-x0>^n for n=...
%
%=============================================
function v=trapsum(abyn)
%
% v=trapsum(abyn)
% ~~~~~~~~~~~~~~~~~~
%
% This function evaluates:
%
% integral(a=>x y(x)*dx) for a<=x<=b
%
% by the trapezoidal rule (which assumes linear
% function variation between succesive function
% values).
%
% ab - limits of integration
% y - integrand that can be a vector-valued
% function returning a matrix such that
% function values vary from row to row.
% It can also be input as a matrix with
% the row size being the number of
% function values and the column size
% being the number of components in the
% vector function.
% n - the number of function values used to
% perform the integration. When y is a
% matrix then n is computed as the number
% of rows in matrix y.
%
% v - integral value
%
if isstr(y)
% y is an externally defined function
x=linspace(abn)'; h=x(2)-x(1);
Y=feval(yx); % Function values must vary in
% row order rather than column
% order or computed results
% will be wrong.
m=size(Y2);
else
% y is column vector or a matrix
Y=y; [nm]=size(Y); h=(b-a)/(n-1);
end
v=[zeros(m); ...
h/2*cumsum(Y(n-:)+Y(n:))];
%=============================================
% function y=lintrp(xdydx)
% See Appendix B