You are on page 1of 2

%Matlab code for First Order Reliability Method (FORM) and First Order Reliability Method (SORM) based on

% numerical differentiation with iterative algorithm.


% The functions (Setup.m, ReliabilityByFORM.p and ReliabilityBySORM.p) are copyrighted by Erik Kostandyan,
% Contact: erik.kostandyan@gmail.com.
%TERMS OF USE
% It is provided for educational purposes only, and prior use of these functions for
% any business-oriented activities in order to generate any type of income,
% should be contacted to the author Erik Kostandyan. In addition, I have the following request
% to the users of these functions, if any scientific publication(s) has been made by using these
% functions, would you please make references to the papers listed in
% 'Read me for MATLAB Reliability By FORM and SORM.pdf'.
%NOTES REGARDING ReliabilityByFORM.p CODE
%%% Input %%%
% If x is a vector of initial variables, x=[x(1), x(2), ... , x(N)], with
% Mean vector, Standard Deviation vector, Correlation Matrix, Distribution
% vector, then the defined Limit State Function has to be in the following format:
% LimitStateFunction=@(x) {and any expression with x(i)},
% dz is the difference quotient in numerical differentiation,
% dB is an absolute error for reliability index estimation,
% Mean_X is Mean row vector,
% SD_X is Standard Deviation row vector,
% Dist_X is Distribution row vector:
% for Normal=1, LogNormal=2, GumbelMax=3, WeibullMin=4, %Uniform=5,
% Cor_X is Correlation Matrix,
% NatafTransform is a binary variable for the decomposition method in Nataf transformation:
% NatafTransform=0 => Based on CholeskyDecomposition, NatafTransform=1 => Based on EigenDecomposition.
%%% Output %%%
% ProbabilityOfFailure_FORM = Probability Of Failure by FORM,
% HL_ReliabilityIndex = Hasofer-Lind Reliability Index,
% Alfa_Z = Unit Row Vector Values in in Normalized Space,
% DesignPoint_Z = Coordinates of Design Point in Normalized Space,
% DesignPoint_X = Coordinates of Design Point in Initial Space,
% GradientVector = Gradient Row Vector at the DesignPoint_Z.
%NOTES REGARDING ReliabilityBySORM.p CODE
%%% Input %%%
% If x is a vector of initial variables, x=[x(1), x(2), ... , x(N)], with
% Mean vector, Standard Deviation vector, Correlation Matrix, Distribution
% vector, then the defined Limit State Function has to be in the following format:
% LimitStateFunction=@(x) {and any expression with x(i)},
% DesignPoint_Z = Coordinates of Design Point in Normalized Space (can be found by FORM),
% dz is the difference quotient in numerical differentiation,
% dB is an absolute error for reliability index estimation,
% Mean_X is Mean row vector,
% SD_X is Standard Deviation row vector,
% Dist_X is Distribution row vector:
% for Normal=1, LogNormal=2, GumbelMax=3, WeibullMin=4, %Uniform=5,
% Cor_X is Correlation Matrix,
% NatafTransform is a binary variable for the decomposition method in Nataf transformation:
% NatafTransform=0 => Based on CholeskyDecomposition, NatafTransform=1 => Based on EigenDecomposition.
%%% Output %%%
% ProbabilityOfFailure_SORM = Probability Of Failure by SORM,
% SORM_ReliabilityIndex = SORM Reliability Index,
% Alfa_Z = Unit Row Vector Values in in Normalized Space,
% GradientVector = Gradient Row Vector at the DesignPoint_Z,
% HessianMatrix = Hessian Matrix at the DesignPoint_Z.
function Setup
% Ex. 1
dz=10^-5;
dB=10^-4;
LimitStateFunction=@(x) 48*x(2)*x(3)-3600*x(1)
Mean_X=[2 2*10^7 2*10^-5]
SD_X=[0.6 3*10^6 2*10^-6]
Dist_X=[1 1 1] % Choose variables distribution: for Normal=1, LogNormal=2, GumbelMax=3, WeibullMin=4, %Uniform=5
Cor_X=[1,0,0; 0,1,0; 0,0,1] % or use Cor_X=eye(length(Mean_X))
NatafTransform=0
% Ex. 2
%dz=10^-5;
%dB=10^-4;
%LimitStateFunction=@(x) x(1)-x(2);
%Mean_X=[50 12.5]
%SD_X=[28.87 12.5]
%Dist_X=[5 4] % Choose variables distribution: %Normal=1, LogNormal=2, GumbelMax=3, WeibullMin=4, %Uniform=5
%Cor_X=[ 1 0.5; 0.5 1]
%NatafTransform=0
% Ex. 3
%dz=10^-5;
%dB=10^-4;
%LimitStateFunction=@(x) x(3)-(9/128)*x(1)*(x(2)^2)
%Mean_X=[2 4 5]
%SD_X=[0.4 0.4 0.4]
%Dist_X=[1 1 1] % Choose variables distribution: %Normal=1, LogNormal=2, GumbelMax=3, WeibullMin=4, %Uniform=5
%Cor_X=[1,0,0; 0,1,0; 0,0,1]
%NatafTransform=0
% Ex. 4
%dz=10^-5;
%dB=10^-4;
%LimitStateFunction=@(x) x(1)-x(2)*x(3)
%Mean_X=[400 1 100]
%SD_X=[20 0.1 30]
%Dist_X=[2 1 3] % Choose variables distribution: %Normal=1, LogNormal=2, GumbelMax=3, WeibullMin=4, %Uniform=5
%Cor_X=[1,0,0; 0,1,0; 0,0,1]

%NatafTransform=0
% Ex. 5
%dz=10^-5;
%dB=10^-4;
%LimitStateFunction=@(x) (x(1)^2)-(x(2)^2)*(x(3)^4)
%Mean_X=[400 1 100]
%SD_X=[20 0.1 30]
%Dist_X=[2 1 3] % Choose variables distribution: %Normal=1, LogNormal=2, GumbelMax=3, WeibullMin=4, %Uniform=5
%Cor_X=[1,0,0; 0,1,0; 0,0,1]
%NatafTransform=0
% Ex. 6
%dz=10^-5;
%dB=10^-4;
%LimitStateFunction=@(x) ((x(2)*x(3))^4)-((x(1)^2)/(x(4)^4))
%Mean_X=[400 200 100 3]
%SD_X=[20 10 30 1.5]
%Dist_X=[2 1 3 5] % Choose variables distribution: %Normal=1, LogNormal=2, GumbelMax=3, WeibullMin=4, %Uniform=5
%Cor_X=[1,0,0,0; 0,1,0,0; 0,0,1,0.3; 0,0,0.3,1]
%NatafTransform=0

%%% Solutions
[ProbabilityOfFailure_FORM,HL_ReliabilityIndex,Alfa_Z,DesignPoint_Z,DesignPoint_X,GradientVector]=ReliabilityByFORM(LimitStateFunction,dz,dB,Mean_X,SD_X,D
DesignPoint_Z=DesignPoint_Z;
[ProbabilityOfFailure_SORM,SORM_ReliabilityIndex,Alfa_Z,GradientVector,HessianMatrix]=ReliabilityBySORM(LimitStateFunction,DesignPoint_Z,dz,Mean_X,SD_X,Di
end

You might also like