Matlab Slope Stability: On '-R' '-R' 'Distance (M) ' 'Elevation (M) ' Off

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Matlab slope stability

%%%This code calculates the factor of safety of a homogeneous soil mass


%%%using the method of slices ad the M-P interslice force function
%% Slope and soil parametersl = dx. /cal;

H = 5; %inpu('Enter the height of the slope'); % height of slope


Xc =1; %inpu('Enter the x coordinate of center of slip circle: Xc %should be>0');
% x coordinate of center of circle
Yc = 7; %input ('Enter the y coordinate of center of slip circle: Yc should
%be greater than H');
% y coordinate of center of circle
R = 8; %:5: Yc+10 % radius of center of slip circle
fr = 45; % slope angle in degrees
ns = 31; % number of slice faces
G = 20; % unit weigh of soil
c = 10; % cohesion of soil
phi = 20; % frictional angle of soil (degrees)
tph = tand(phi); % tangent of the frictional angle of soil
tfr = tand(fr); % slope angle in gradient

%% Slip surface generation


xmin = Xc - sqrt(abs(R^2 - Yc^2)) % Exit point of slip circle
xmax = Xc + sqrt(abs(R^2 - (Yc-H)^2)) % Entry point of slip circle
x = linspace (xmin,xmax,ns)';% Positions where the forces will be analyzed.
ybot = Yc - sqrt(abs(R^2-(x-Xc).^2)); % Equation for generating slip circle

%% Slope surface generation


ytop = (x>=0).*(x<(H/tfr)).*(x*tfr) + (x>=(H/tfr)).*H; % Slope surface.

%equation of a line is used


figure(1)
hold on
plot (x,ybot,'-r',x,ytop,'-r')
xlabel ('Distance (m)')
ylabel ('Elevation (m)')
plot(reshape([x,x,x].',1,[]),reshape([ytop,ybot,ytop*NaN].',1,[]))
hold off

%% Other parameters
hs = ytop-ybot; % Height at each node
havg = (hs(1:end-1)+hs(2:end))/2; % 5) Average height of each slice
xavg = abs(((x(1:end-1)+x(2:end))/2)-Xc); % midpoint distance of each slice
dx = (xmax-xmin)/(ns-1); % Width of each slice
yb = (diff(ybot));
alpha = rad2deg(atan2(yb,dx)); % Slice angle. With atan2 the sign is clear.
sal = sind(alpha);
cal = cosd(alpha);
A = dx.*havg; % 6) Area of each slice.
W = G*A; % 7) Weight of each slice.
s= R*sal; % offset f for non-circular slip surfaces
l = dx./cal; % 12) Length of the bottom of the slice, assuming straight
u = 0;

%% factor of safety computation


upO = sum((c.*l) + (W.*cal*tph) - (u.*l*tph));
downO = sum(W.*sal);
FSom = upO./downO
OFSm = FSom;
NFSm = 1.2*FSom; %initial guessed F
OFSf = FSom;
NFSf = 1.2*FSom;
Tol =0.001;
t =-1:0.2:0;
y=t';
i=1;
k=1;
n=1; %: ns-1;
for lbd=t;
E (1) =0;
d=1: ns-1;
f=sind (((xavg (d)-xmin)/ (xmax-xmin))*180);
X=E.*lbd.*f;
while abs(OFSm-NFSm)>Tol
OFSm = NFSm;
Nbu = ((W-X) - ((c.*l.*sal) - (u.*l.*tph.*sal))./OFSm);
Nbd = cal + (tph.*sal)./OFSm;
Nob = Nbu./Nbd;
upb = sum((c.*l*R) + (Nob.*tph*R) - (u.*l*tph*R));
downb = sum(W.*xavg);
FSm = upb./downb;
FSmm = ((FSm)) %./(ns-1));
NFSm = FSmm;
FSM (i)=FSmm;
end
while abs(OFSf-NFSf)>Tol
OFSf = NFSf;
Nju = ((W-X) - ((c.*l.*sal) - (u.*l.*tph.*sal))./OFSf);
Njd = cal + (tph.*sal)./OFSf;
Noj = Nju./Njd;
upj = sum( (c.*l.*cal) + (tph*cal.*Noj) - (u.*l.*tph.*cal) );
downJ = sum(Noj.*sal);
FSf = (upj./downJ);
FSf = (FSf) %./(ns-1));
NFSf = FSf;
FSF (i)= FSf;
end
E = (((c.*l-u.*l.*tph).*cal)./OFSm) + (sal.*Nob)-((tph.*cal).*Nob./OFSm);
E = (((c.*l-u.*l.*tph).*cal)./OFSm) + (sal.*Noj)-((tph.*cal).*Noj./OFSm);
OFSm = FSom;
OFSf = FSom;
i=i+1;

end

fSM=FSM'
fSF=FSF'

figure(2)
plot(y,fSM,'-r',y,fSF,'-b')

%% finding intersection point


[xi, yi] = polyxpoly(y, fSM, y, fSF);
xlabel('lambda')
ylabel('FoS')
legend('FSm', 'FSf')
mapshow(xi,yi,'DisplayType','point','Marker','o', 'MarkerEdgeColor','k');
axis normal
strValues = strtrim(cellstr(num2str([xi yi],'(%0.3f,%0.3f)')));
text (xi,yi,strValues,'VerticalAlignment','bottom');
[xi yi] % Display intersection points

You might also like