s2rout2.m
来自「Industrial Mathematics」· M 代码 · 共 16 行
M
16 行
% Routine 2.2 N = 10000; % set the number of trialsm = 0; % initialize mean failure timem2 = 0; % initialize the second momentfor i = 1:N % begin trials x = 11 + randn; % fail time for component \# 1 y = 12 + 2*randn; % fail time for component \# 2 z = 13 + 3*randn; % fail time for component \# 3w = min([x,y,z]); % min fail time of \# 1, \$ 2, and \# 3 m = m + w/N; % add this trial to mean fail time m2 = m2 + w*w/N; % add this trial to second moment end; % end of each trialm % display the MTBF sd = sqrt(m2 - m*m) % compute the standard deviation
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?