%% [BM]: MATLAB Code for Bayesian Method function [thetaHat,rul]=BM(para0,weigh) clear global; global DegraUnit initDisPar TimeUnit ... time y thres ParamName thetaTrue signiLevel ns ny nt np %=== PROBLEM DEFINITION 1 (Required Variables) ============== WorkName=' '; % work results are saved by WorkName DegraUnit=' '; % degradation unit TimeUnit=' '; % time unit (Cycles, Weeks, etc.) time=[ ]'; % time at both measurement and prediction y=[ ]'; %[nyx1]: measured data thres= ; % threshold (critical value) ParamName=[ ]; %[npx1]: parameters' name to be estimated initDisPar=[ ]; %[npx2]: prob. parameters of init./prior dist thetaTrue=[ ]; %[npx1]: true values of parameters signiLevel= ; % significance level for C.I. and P.I. ns= ; % number of particles/samples burnIn= ; % ratio for burn-in %============================================================ % % % PROGNOSIS using BM with MCMC ny=length(y); nt=ny; np=size(ParamName,1); sampl(:,1)=para0; %% Initial Samples [~,jPdf0]=MODEL(para0,time(1:ny)); %% Initial (joint) PDF for i=2:ns/(1-burnIn); %% MCMC Process % proposal distribution (uniform) para1(:,1)=unifrnd(para0-weigh,para0+weigh); % (joint) PDF at new samples [~,jPdf1]=MODEL(para1,time(1:ny)); % acception/rejection criterion if rand