%Estimate parameters under consideration by solving the proposed %optimization model %Read in patient data A0 = xlsread('patient data.xlsx', 'Sheet1', 'A2:D340'); P=zeros(49, 7); % set the output matrix tau_0 = 4.5; % set estimation tolerance 4.5 pmol/L of FT4 global B; global NumOfvisit; NumOfvisit = 5; %Number of patient visits to be used in the dataset for i=1:49 temp = find(A0(:, 1) ==i); %define the row indices wrt patient i B =A0(temp,2:4); %define patient data (d, t, y) wrt patient i m = size(B, 1); % row number of B x0= 0.35*ones(4,1); A=[]; b=[]; Aeq=[]; beq=[]; ub=zeros(4,1); lb=zeros(4,1); for k=1:4 ub(k)=10^(6); lb(k)=10^(-4); end ub(2)=150; [x, fval, exitflag]=fmincon('objfun', x0, A, b, Aeq, beq, lb, ub, 'constraint'); P(i, 1) = i; % deine patient SN P(i, 2) = x(1); % define A: rate of synthesis of FT4 concentration P(i, 3) = x(2); % define IC_50: dose of ATD that reduces y by half P(i, 4) = x(3); % define C: constant decay rate P(i, 5) = - x(4); % define C1: constrant of general solution of ODE P(i, 6) = exitflag; % convergence indicator P(i, 7) = m; % number of patient visits filename = 'Parameter estimation results.xlsx'; cname_input=[{'Patient S/N'},{'A'},{'IC_50'}, {'C'}, {'C1'}, {'Exitflag'}, {'Number of visits'}]; xlswrite(filename, cname_input,'Sheet1','A1') xlswrite(filename, P, 'Sheet1', 'A2'); end return