Code Kim
Code Kim
clc;
clear all;
close all; % Ðóng tat ca figure de tránh xung ðot
Ra = 1 - (1 - Rpsd1) .* (1 - Rpsd2);
Rb = 1 - (1 - Rpsv1) .* (1 - Rpsv2);
Rc = 1 - (1 - Rcb1) .* (1 - Rcb2);
% Ve ðo thi
figure(2);
plot(t, Rs, 'b', 'LineWidth', 1.5);
xlabel('Time t');
ylabel('Value Rs');
title('Bieu do Rs theo thoi gian');
grid on;
% Giá tri nho nhat cua Rs
GTNN = min(Rs);
disp(['Giá tr? nh? nh?t c?a Rs: ', num2str(GTNN)]);
Câu 3:
clc
clear all
beta = 2.1;
theta = 1531.4;
Cp = 1000;
stt = 6;
Cf = (3 + stt/20)*Cp;
f = @(t)1-wblcdf(t,theta,beta);
tp = 500:2000;
UEC = zeros(1,length(tp));
inte = zeros(1,length(tp));
for i=1:length(tp)
inte(i) = integral(f,0,tp(i));
R = 1-wblcdf(tp(i),theta,beta);
F = wblcdf(tp(i),theta,beta);
UEC(i) = (Cp*R+Cf*(1-R))/(inte(i));
end
b = min(UEC);
Opt_tp = find(UEC==b);
Optimaltp=tp(Opt_tp);
plot(tp,UEC,'linewidth',1.5)
hold on
plot(tp(Opt_tp),b,'*','linewidth',2.5)
title('Ve ham UEC(tp)')
xlabel('tp(h)')
ylabel('UEC($/h)')
grid on
set(gca,'Fontsize',12,'linewidth',1.5)