clc
clear all
close all
% Менять только систему ВНИЗУ
[t,p]=ode23(@prc1, [0:0.5:50] ,[1 0 0 0 0 0]);
disp(1)
p(1,1:end)
for i=5:5:50
disp(i)
p(2*i + 1,1:end)
end
figure('Color','white')
plot(t,p,'-k')
hline=findobj(gcf,'type','line');
set(hline(1),'LineStyle','-','LineWidth',1);
set(hline(2),'LineStyle','--','LineWidth',1);
set(hline(3),'LineStyle',':','LineWidth',1);
set(hline(4),'LineStyle','-.','LineWidth',1);
set(hline(5),'LineStyle','-','LineWidth',2);
set(hline(6),'LineStyle','--','LineWidth',2);
xlabel('t')
ylabel('P')
legend({'p1','p2','p3','p4','p5','p6'},'Location','northeast')
grid;
P = p(1 : 101, 1) + p(1 : 101, 2);
figure('Name', 'Режим безотказной работы');
title('Name', 'Вероятность режима безотказной работы')
plot(t,P,'-k')
xlabel('t')
ylabel('P')
grid;
% Менять только ВОТ ЭТО
function dp=prc1(t,p)
dp = zeros(6,1);
dp(1)=(0.9)*p(6)-(0.9)*p(1);
dp(2)=(0.9)*p(1)-(0.1)*p(2)-(0.8)*p(2);
dp(3)=(0.1)*p(2)+(0.9)*p(4)-(0.9)*p(3)-(0.2)*p(3);
dp(4)=(0.9)*p(3)+(0.3)*p(6)-(0.9)*p(4);
dp(5)=(0.8)*p(2)+(0.2)*p(3)-(0.5)*p(5);
dp(6)=(0.5)*p(5)-(0.9)*p(6)-(0.3)*p(6);
end
clear all
close all
% Менять только систему ВНИЗУ
[t,p]=ode23(@prc1, [0:0.5:50] ,[1 0 0 0 0 0]);
disp(1)
p(1,1:end)
for i=5:5:50
disp(i)
p(2*i + 1,1:end)
end
figure('Color','white')
plot(t,p,'-k')
hline=findobj(gcf,'type','line');
set(hline(1),'LineStyle','-','LineWidth',1);
set(hline(2),'LineStyle','--','LineWidth',1);
set(hline(3),'LineStyle',':','LineWidth',1);
set(hline(4),'LineStyle','-.','LineWidth',1);
set(hline(5),'LineStyle','-','LineWidth',2);
set(hline(6),'LineStyle','--','LineWidth',2);
xlabel('t')
ylabel('P')
legend({'p1','p2','p3','p4','p5','p6'},'Location','northeast')
grid;
P = p(1 : 101, 1) + p(1 : 101, 2);
figure('Name', 'Режим безотказной работы');
title('Name', 'Вероятность режима безотказной работы')
plot(t,P,'-k')
xlabel('t')
ylabel('P')
grid;
% Менять только ВОТ ЭТО
function dp=prc1(t,p)
dp = zeros(6,1);
dp(1)=(0.9)*p(6)-(0.9)*p(1);
dp(2)=(0.9)*p(1)-(0.1)*p(2)-(0.8)*p(2);
dp(3)=(0.1)*p(2)+(0.9)*p(4)-(0.9)*p(3)-(0.2)*p(3);
dp(4)=(0.9)*p(3)+(0.3)*p(6)-(0.9)*p(4);
dp(5)=(0.8)*p(2)+(0.2)*p(3)-(0.5)*p(5);
dp(6)=(0.5)*p(5)-(0.9)*p(6)-(0.3)*p(6);
end
Соседние файлы в папке ПР2