% Example: multirod
% ~~~~~~~~~~~~~~~~~
% This example analyzes the effects of a load
% applied to the point of interconnect for
% several rods. The user defines the
% characteristics of each rod (theta, area, E).
% The resulting displacement of the point
% where the gravity load is applied is
% determined.
%
% Data is defined in the declaration statements
% below, where:
%
% W - gravity load
% D - vertical height of rods
% Theta - vector containing the angle in
% degrees for each rod measured
% from positive y-axis, + is CCW
% Area - vector containing area of each rod
% E - vector containing E for each rod
%
% User m functions required: none.
%----------------------------------------------
clear;
%...Input definitions
Problem=1;
if Problem == 1
W=10000; D=100;
Theta=[0 45 -30 20 -70 ];
Area= [0.1 0.2 0.15 0.25 0.4 ];
E= [30e6 10.6e6 12e6 30e6 22e6];
end
degrad=pi/180; Theta=Theta*degrad;
loop=length(E); loop1=loop+1; loop2=loop+2;
sintheta=sin(Theta); costheta=cos(Theta);
b=zeros(loop2,1); A=zeros(loop2,loop2);
%...Rod length and flexibility coefficient
Lrod=D./costheta; Flex=Lrod./(Area.*E);
%...Setup and solve simultaneous equations
A=diag(Flex);
A(1:loop,loop1)=-sintheta';
A(1:loop,loop2)=-costheta';
A(loop1,1:loop)= costheta;
A(loop2,1:loop)= sintheta;
b(loop1)=W; x=A\b;
%...Equilibrium check
sumFx=sum(x(1:loop).*sintheta');
sumFy=W-sum(x(1:loop).*costheta');
fprintf('\n\nAnalysis of Muliple Rods');
fprintf( '\n------------------------');
for i=1:loop
fprintf('\n\nRod # %g',i);
fprintf('\n Force: %g',x(i));
fprintf('\n Length: %g',Lrod(i));
fprintf('\n Flex. Coef.: %g',Flex(i));
end
fprintf('\n\nFinal Location of Load Point\n');
fprintf( '\n Delta x (+ right): %g',x(loop1));
fprintf( '\n Delta y (+ down): %g',x(loop2));
fprintf('\n\nEquilibrium Check\n');
fprintf( '\n Sum Fx: %g',sumFx);
fprintf( '\n Sum Fy: %g',sumFy);
fprintf('\n');