| 查看: 1943 | 回复: 2 | ||
zb140108金虫 (著名写手)
|
[求助]
求一个蒙特卡洛故障树仿真程序 已有1人参与
|
初次接触这方面的内容,求一个蒙特卡洛故障树仿真程序,最好有注释,初学者能看懂的,谢谢 |
» 猜你喜欢
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有3人回复
参与限项
已经有3人回复
假如你的研究生提出不合理要求
已经有7人回复
实验室接单子
已经有4人回复
全日制(定向)博士
已经有4人回复
对氯苯硼酸纯化
已经有3人回复
求助:我三月中下旬出站,青基依托单位怎么办?
已经有12人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复
北核录用
已经有3人回复
zb140108
金虫 (著名写手)
- 应助: 0 (幼儿园)
- 金币: 15391.2
- 散金: 1032
- 帖子: 2014
- 在线: 83.4小时
- 虫号: 2602766
- 注册: 2013-08-17
- 性别: GG
- 专业: 声学
|
这是我找到的一段代码,求注释 clear,close all; Tmax=100000;%仿真工作时间 M=1000;%时间间隔 del_t=Tmax/M; for r=1:M t(r)=r*del_t; end NS=1000;%仿真次数 t1=normrnd(20000,1500,NS,1); t2=normrnd(18000,1300,NS,1); t3=exprnd(25000,NS,1); t4=exprnd(20000,NS,1); t5=exprnd(20000,NS,1); t6=normrnd(18500,150,NS,1); t7=exprnd(1000,NS,1); t8=exprnd(21500,NS,1); t9=exprnd(21500,NS,1); t10=exprnd(18000,NS,1); T=[t1,t2,t3,t4,t5,t6,t7,t8,t9,t10];%得到仿真数据 NUM=zeros(NS,10); tk=zeros(1,NS); for L=1:NS tt=T(L, ; %抽样原始值ttf=sort(T(L, );%排序后的抽样值(由小到大)Z=zeros(1,10); %将全部基本部件赋予初始值,即将它们置于有效状态 for j=1:10 for i=1:10 if ttf(j)==tt(i) Z(i)=1; tk(L)=ttf(j); break; end end PHA=Z(2)+Z(5)*Z(6)+Z(3)+Z(1)+Z(7)*Z(8)+Z(4)+Z(9)*Z(10); if PHA==1 NUM(L,i)=NUM(L,i)+1; break; end end end delete=0; for i=1:NS if tk(i)>Tmax delete=delete+1; end end deta_m=zeros(1,M); for n=1:NS if tk(n)<=t(1) deta_m(1)=deta_m(1)+1; end for r=2:M if tk(n)>t(r-1)&&tk(n)<=t(r) deta_m(r)=deta_m(r)+1; end end end for r=1:M m(r)=sum(deta_m(1:r)); end F=m/NS; R=1-m/NS; plot(F) figure,plot(R) |
2楼2016-02-26 19:05:05
桐同
新虫 (初入文坛)
- 应助: 0 (幼儿园)
- 金币: 82.6
- 散金: 5
- 帖子: 33
- 在线: 8.4小时
- 虫号: 22165373
- 注册: 2020-05-18
- 性别: MM
- 专业: 系统可靠性与管理
3楼2021-03-28 21:39:14












回复此楼
; %抽样原始值