📄 repair.m
字号:
% repair.m sets up matrices for a model of the number of machines working% and the number in repairN = 40; % total number of machinesM = 30; % maximum number in useR = 3; % capacity of repair facilityS = 0:40; % state spacemu = zeros(1,N+1); % initial distributionmu(M+1) = 1; Tmax = 20; % maximum time for simulationdelta = 1; % rate at which failures occurrho = 10; % rate at which repairs occurA = zeros(N+1);for i=1:N, A(i+1,i) = delta*min(i,M); A(i,i+1) = rho*min(R,N+1-i);endfor i=1:N+1, A(i,i) = -sum(A(i,:));endlambda = -diag(A);Q = diag(1./lambda)*A+eye(size(A));subplot(3,1,1)processtitle('repair.m, N = 40, M = 30, R = 3, \delta = 1, \rho = 10')grid onsubplot(3,1,2)processgrid onsubplot(3,1,3)plot(0:N, invariant(expm(A)));title('Invariant distribution')
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -