% Example: rbar2
% ~~~~~~~~~~~~~~
% This example calculates the deflection of
% a rigid bar suspended by a set of cables.
% This version uses the regular loop
% indexing.
%
% Data is defined in the declaration statements
% below, where:
%
% W - gravity load
% Xcable - vector containing x location for
% each cable
% Lcable - vector containing cable lengths
% Acable - vector containing cable areas
% Ecable - vector containing cable Es
% No_W_load_pts - number of solutions to
% generate for different positions
% of applied W
%
% User m functions required:
% genprint
%----------------------------------------------
clear;
%...Input definitions
Problem=1;
if Problem == 1
W=100000; No_W_load_pts=10;
Xcable=[ 0 48 120 192 ];
Lcable=[ 72 120 84 96 ];
Acable=[ 1 2 0.75 0.5 ];
Ecable=[30e6 10.6e6 30e6 30e6];
end
No_cables=length(Ecable);
%...Calculate AE/L and X ratio for each cable
for i=1:No_cables
Cael(i)=(Acable(i)*Ecable(i))/Lcable(i);
Xratio(i)=Xcable(i)/Xcable(No_cables);
end
%...Setup and solve simultaneous equations
A=zeros(2,2);
for i=1:No_cables
temp=Xratio(i)*Cael(i);
A(1,1)=A(1,1)+Cael(i)-temp;
A(1,2)=A(1,2)+temp;
A(2,1)=A(2,1)+Xcable(i)*Cael(i)*(1-Xratio(i));
A(2,2)=A(2,2)+Xcable(i)*temp;
end
b(1)=W;
%...Solve for extreme locations of W
Xleft=A(2,1)/A(1,1); Xright=A(2,2)/A(1,2);
%...........................................
%...Loop to solve for deflection, force, and
%...stress in each cable as load is moved
%...across allowable range
%...........................................
X_inc=(Xright-Xleft)/No_W_load_pts;
Xw=Xleft:X_inc:Xright;
for j=1:No_W_load_pts+1
%...Solve simultaneous equations
b(2)=W*Xw(j); x=A\b';
%...Calculate remaining quantities
for i=1:No_cables
Delta(j,i)=(1-Xratio(i))*x(1)+ ...
Xratio(i)*x(2);
Fcable(j,i)=Cael(i)*Delta(j,i);
Stress(j,i)=Fcable(j,i)/Acable(i);
end
end
Delta=-Delta;
fprintf('\nRigid Bar Suspended by Cables');
fprintf('\n-----------------------------');
fprintf('\n\nAcceptable Range of Load Point\n');
fprintf( '\n X (left): %g',Xleft);
fprintf( '\n X (right): %g',Xright);
for j=1:No_W_load_pts+1
fprintf('\n\nW at x = %g',Xw(j));
for i=1:No_cables
fprintf('\n Cable # %g',i);
fprintf('\n Force: %g',Fcable(j,i));
fprintf('\n Stress: %g',Stress(j,i));
fprintf('\n Deflection: %g',Delta(j,i));
end
end
fprintf('\n');
clf; plot(Xcable,Delta);
title(['Rigid Bar Positions for Each' ...
' Load Location']);
xlabel('x Position Along Rigid Rod');
ylabel('Displacement'); drawnow;
% genprint('rod-xy');
disp('Press key to continue'); pause
clf; meshz(Xcable,Xw,Delta);
title(['Rigid Bar Positions for Each' ...
' Load Location']);
xlabel('x Position Along Rigid Rod');
ylabel('Location of W');
zlabel('Displacement');
view(-45,60); drawnow;
% genprint('mesh-rod');