Team:Paris/Modeling/More f1 Algo

From 2008.igem.org

Revision as of 09:43, 29 October 2008 by Hugo (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

find_ƒ1

function optimal_parameters = find_f1(X_data, Y_data, initial_parameters)
 
% gives the 'best parameters' involved in f1 by least-square optimisation
 
% X_data = vector of given values of a [aTc]i (experimentally
% controled)
% Y_data = vector of experimentally measured values f1 corresponding of
% the X_data
% initial_parameters = values of the parameters proposed by the literature
%                       or simply guessed
%                    = [beta1, (K20 -> (gamma.K20)/(coefTet.f0)), n20, K19, n19]
 
% Warning : in the global parameters, K20 -> K20/coefTet
 
     function output = expr_pTet(parameters, X_data)
         for k = 1:length(X_data)
                 output(k) = parameters(1) * ( 1 - hill( (1 - hill( X_data(k), parameters(4), parameters(5) )), parameters(2), parameters(3) ) );
         end
     end
 
options = optimset('LevenbergMarquardt','on','TolX',1e-10,'MaxFunEvals',1e10,'TolFun',1e-10,'MaxIter',1e4);
% options for the function lsqcurvefit
 
optimal_parameters = lsqcurvefit( @(parameters, X_data) expr_pTet(parameters, X_data), initial_parameters, X_data, Y_data,...
     1/10*initial_parameters, 10*initial_parameters, options );
% search for the fittest parameters, between 1/10 and 10 times the initial
% parameters
 
end

Inv_ƒ1

function quant_aTc = Inv_f1(inducer_quantity,aTc_0)
 
% gives the quantity of [aTc]i needed to get inducer_quantity of a protein
% throught a gene behind pTet
 
global gamma, f0;
 
     function equa = F(x)
         equa = f1( (f0/gamma) , x ) - inducer_quantity;
     end
 
options = optimset('LevenbergMarquardt','on','TolX',1e-10,'MaxFunEvals',1e10,'TolFun',1e-10,'MaxIter',1e4);
 
quant_aTc = fsolve(F,aTc_0,options);
 
end