|
发表于 12-7-2019 17:14:38|来自:新加坡
|
显示全部楼层
本帖最后由 hpnasp 于 16-7-2019 16:30 编辑
clc;clear all;
Private.deductible=3500;
Private.copayment=0.1;
Company.proration=0.5;
Company.copayment=0.1;
Company.cap=35000;
%
syms x
eqn1 =x-(x-Private.deductible)*(1-Private.copayment)-((x*Company.proration)-Company.copayment*(x*Company.proration))==0
eqn2 =x-(x-Private.deductible)*(1-Private.copayment)-Company.cap==0
[solmin, params, conds] = solve(eqn1, x, 'ReturnConditions', true)
[solmax, params, conds] = solve(eqn2, x, 'ReturnConditions', true)
[solmin,solmax] % 0 out-of-pocket range
% boss vs novice package
i=1
hold on
for Bill=[0:1000:100000] % Total medical bill
Private.deductible=3500;
Private.copayment=0.1
Company.proration=0.5;
Company.copayment=0.1;
Company.cap=35000;
% private
Self.private=(Bill-Private.deductible)-(Bill-Private.deductible)*Private.copayment
if Bill<Private.deductible
Self.private=0;
end
% company
Self.company=(Bill*Company.proration)-Company.copayment*(Bill*Company.proration)
if Self.company>Company.cap
Self.company=Company.cap
end
if Self.private+Self.company-Bill>0
Self.outofPocket=0
else
Self.outofPocket=Bill-Self.company-Self.private
end
price_chart(i,:)=[Bill,Self.outofPocket];
i=i+1
end
plot(price_chart(:,1),price_chart(:,2))
xlabel('Medical Bill')
ylabel('Amount Payable')
max_amount_payable=max(price_chart(:,2));
|
|