function [ M, F1, F2 ] = Shaft_Moment( X, Load, R1, R2 ) % % This routine computes the moments on a shaft given point loads at % specific locations along the shaft. % % Input % % X = The location along the shaft where the moment is computed % Load an array of the locations and amounts for the loads. Row 1 % contains the location and Row 2 contains the loads. % R1 location of the first reaction along the shaft (support bearing) % R2 location of the second reaction along the shaft (support bearing) % % Output % % M The moment % F1 The force at reaction 1 % F2 The force at reaction 2 % First we need to compute the reaction forces at the bearings. We will % sum the moments around R1 to compute F2, the reaction force at bearing % 2. nLoads = size(Load); %get the number of loads moment = 0; % Sum the moments at R1 to compute the force at reaction 2 % Now sum the forces to compute the reaction force at reaction 1 % Now we compute the moment at X % Add the moments caused by the reactions end