Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function P()
- Sum=0
- Maxisp=5000
- Maxt=30000
- MatrixGammaBin=1:13
- MatrixExpBin=1:20
- MatrixWeibullBin=1:25
- MatrixS(Maxt)=0
- MatrixResult(Maxt)=0
- for isp=1:Maxisp
- //Weibull
- TAU=-1
- for k=1:25
- while or([(TAU>30000), or(TAU<0)]) do
- R=grand(1,1,'unf',0,1)
- TAU=10000 * (-log(R))^(1/3) //k=3, lambda=10000
- end
- MatrixWeibull(k)=round(TAU)
- TAU=-1
- end
- //EndofWeibull
- //Exp
- for k=1:20
- R=(grand(1,1,'unf',0,1))
- TAU = -(1 / 0.0001) * log(R)
- MatrixExp(k)=round(TAU)
- end
- //EndofExp
- //Gamma
- R1=9;
- R2=9;
- R3=9;
- TAU=-1;
- MatrixGamma=1:13
- for k=1:13
- while or([(TAU>30000), or(TAU<0)]) do
- R1=grand(1,1,'unf',0,1)
- R2=grand(1,1,'unf',0,1)
- R3=grand(1,1,'unf',0,1)
- TAU=-(1 / 0.0001) * (log(R1) + log(R2) + log(R3))
- end
- MatrixGamma(k)=round(TAU)
- TAU=-1
- end
- //EndofGamma
- for t=1:Maxt
- for i=1:13
- if MatrixGamma(i)>t then
- MatrixGammaBin(i)=1
- else
- MatrixGammaBin(i)=0
- end
- end
- for ii=1:20
- if MatrixExp(ii)>t then
- MatrixExpBin(ii)=1
- else
- MatrixExpBin(ii)=0
- end
- end
- for iii=1:25
- if MatrixWeibull(iii)>t then
- MatrixWeibullBin(iii)=1
- else
- MatrixWeibullBin(iii)=0
- end
- end
- S = 1 - ((1 - MatrixWeibullBin(1) * MatrixExpBin(1)) * (1 - MatrixWeibullBin(2) * MatrixExpBin(2)) * (1 - MatrixWeibullBin(3) * MatrixExpBin(3) * MatrixGammaBin(1)) * (1 - MatrixWeibullBin(4) * MatrixExpBin(4) * MatrixGammaBin(2)) * (1 - MatrixWeibullBin(5) * MatrixExpBin(5) * MatrixGammaBin(3)) * (1 - MatrixWeibullBin(6) * MatrixWeibullBin(7) * MatrixExpBin(6) * MatrixGammaBin(4)) * (1 - MatrixWeibullBin(8) * MatrixWeibullBin(9) * MatrixExpBin(7) * MatrixGammaBin(5)) * (1 - MatrixWeibullBin(10) * MatrixWeibullBin(11) * MatrixExpBin(8) * MatrixGammaBin(6)) * (1 - MatrixWeibullBin(12) * MatrixWeibullBin(13) * MatrixExpBin(9) * MatrixGammaBin(7)) * (1 - MatrixWeibullBin(14) * MatrixWeibullBin(15) * MatrixExpBin(10) * MatrixGammaBin(8)) * (1 - MatrixWeibullBin(16) * MatrixWeibullBin(17) * MatrixExpBin(11) * MatrixExpBin(12) * MatrixGammaBin(9)) * (1 - MatrixWeibullBin(18) * MatrixWeibullBin(19) * MatrixExpBin(13) * MatrixExpBin(14) * MatrixGammaBin(10)) * (1 - MatrixWeibullBin(20) * MatrixWeibullBin(21) * MatrixExpBin(15) * MatrixExpBin(16) * MatrixGammaBin(11)) * (1 - MatrixWeibullBin(22) * MatrixWeibullBin(23) * MatrixExpBin(17) * MatrixExpBin(18) * MatrixGammaBin(12)) * (1 - MatrixWeibullBin(24) * MatrixWeibullBin(25) * MatrixExpBin(19) * MatrixExpBin(20) * MatrixGammaBin(13)))
- //TODO: исправить алгоритм суммирования
- MatrixS(t)=MatrixS(t)+S
- Sum=Sum+MatrixS(t)
- //Pt=((1/Maxisp)*Sum)
- //MatrixResult(t)=MatrixResult(t)+Pt
- Sum=0
- end
- print(%io(2),isp,clock())
- if modulo(isp,100)==0 then
- clf()
- plot2d(MatrixS)
- end
- end
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement