monte carlo method to calculate failure

조회 수: 4 (최근 30일)
carmen gomez
carmen gomez 2021년 4월 1일
편집: the cyclist 2021년 4월 1일
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
the cyclist
the cyclist 2021년 4월 1일
편집: the cyclist 2021년 4월 1일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Monte-Carlo에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by