%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 1. Estiamte FT4 values for given time period and drug dose % 2. Determine ATD drug dose to achieve a target FT4 for a given time period %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Here, take patient 2 as an exampple % Estimate FT4 value x_dose = [ 3 5 8 10 13]; %% given varisous dosages t=[35 56 63]; %% given different time periods ft4= zeros(5,3); for i=1:5 for j=1:3 temp1 = 3.024/(58.151 + x_dose(i)); temp2 = 0.154/(58.151 + x_dose(i)); ft4(i,j) = (temp1 * exp(temp1*t(j)))/(0.003*exp(temp1*t(j)) - temp2); end end ft4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % find the optimal drug dosage, given time period and target FT4 values ft4_initial = 75; target_ft4 = 12; % set target FT4 value = 12 t=[35 42 49 56 63]; % given review periods epsilon = 10^-8; x_dose = zeros(5, 1); for i=1:5 a_dose = 0; % (minimum dosage) fa = Inf; b_dose = 300; %(maximum dosage) fb = -Inf; while b_dose - a_dose > epsilon x_dose(i) = (a_dose + b_dose)/2; temp1 = 3.024/(58.151 + x_dose(i)); temp2 = 0.154/(58.151 + x_dose(i)); fx = (temp1 * exp(temp1*t(i)))/(0.003*exp(temp1*t(i)) - temp2) - target_ft4; if fx == 0 break elseif sign(fx) == sign (fa) a_dose = x_dose(i); fa = fx; else b_dose = x_dose(i); fb = fx; end end end x_dose