monte carlo method to calculate failure

Need help with this code i am suppose to find the probability failure and and the reliability of the beam
%USE MONTE CARLO METHOD TO CALCULATE PROBABILITY OF FAILUREAND...RELIABILITY INDEX FOR THE GIVEN BEAM
%The given limit state function for the given beam is
%g = L/360 - 0.0069*(w*L^4)/(E*I);
%Given :
%The total length of the beam is 15 meters
L = 5;
n = 100000000;
%Unit Weight
mean_w = 10;
sigma_w = 0.4;
%Young's Modulus
mean_E = 2*10^7;
sigma_E = 0.5*10^7;
%Moment of Inertia
mean_I = 8*10^-4;
sigma_I = 1.5*10^-4;
%Now use normrnd function
w = normrnd(mean_w, sigma_w, [n,1]);
E = normrnd(mean_E, sigma_E, [n,1]);
I = normrnd(mean_I, sigma_I, [n,1]);
%
g = zeros(n,1);
K = 0;
%Create for loop
for i=1:n
g(i,1) = L/360 - 0.0069*(w(i,1)*L^4)/(E(i,1)*I(i,1));
if g(i,1)<0
K = K + 1;
end
end
P_fail = K/n;

1 commentaire

the cyclist
the cyclist le 1 Avr 2021
Modifié(e) : the cyclist le 1 Avr 2021
What help do you need? Be specific. Are you getting an error from this code? If so, what is the complete error message? Or is it just not giving you the expected result?
Also, note that I used the CODE button to format your code. Please do the same in the future. It is much easier to read, and copying the code is made easier.

Connectez-vous pour commenter.

Réponses (0)

Catégories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by