Code covered by the BSD License

# Mastering Mechanics 1: Using MATLAB 5

### Doug Hull (view profile)

20 Aug 2002 (Updated )

Companion Software

CH3402.m
```clear all %get rid of all variables and such
clc %clear the comand window
close all %close all figures

NOP=2000; %number of data points
L=10; %meters
SupportLocation=[2 4 7 10]; %meters
PointLoad=[0 -25 3 0; 0 35 5 0]; %newtons
DistPlace=[7 9]; %meters
DistMag=[-20 -20]; %newtons
MomentPlace=[6]; %meters
E=210e9; %Pascals
I=17e-6; %Meters^4
%%%%%Don't alter below this line!%%%%%

SupportLocation=sort(SupportLocation);

if length(SupportLocation)>1  %The last support is not redundant
Redundants=SupportLocation(1:length(SupportLocation)-1);
else
Redundants=0;
end

x=linspace(0,L,NOP);

Last=max(SupportLocation);

Unknowns=[DR(90) 0 0;DR(90) Last 0;0 0 0];
Left=Reactions(1,2);
Right=Reactions(2,2);

s(1,:)=diagram(x,'point',Left,0);
s(2,:)=diagram(x,'point',Right,Last);

end

for gapli=1:rows(DistMag)
DLShear(gapli,:)=diagram(x,'distributed',DistMag(gapli,:),DistPlace(gapli,:));
end

TS=[s;PLShear;DLShear]; %Total Shear

end

RedundantForces=0;
end

left=-mag(sumforce(af),'y')-right-sum(RedundantForces);

for gapli=1:length(RedundantForces);
RFShear(gapli,:)=diagram(x,'point',RedundantForces(gapli),Redundants(gapli));
end

RFShear=sum(RFShear,1); %Redundant Force Shear

clear s
s(1,:)=diagram(x,'point',left,0);
s(2,:)=diagram(x,'point',right,Last);

Shear=RFShear+PLShear+sum(s)+DLShear;
clear m
m(1,:)=diagram(x,'point',-RedundantMoment,0);
m(2,:)=diagramintegral(x,Shear);
end
Moment=sum(m);

[d sl]=displace(x,Moment,['place' 'slope'],[0 0],E,I);

figure(1)
clf
plotSMSD(x,Shear,Moment,sl,d)
hold on