Skip to main content
. Author manuscript; available in PMC: 2011 Mar 15.
Published in final edited form as: J Magn Reson. 2009 May 29;200(1):21–28. doi: 10.1016/j.jmr.2009.05.012

Table 1.

A code Fragment example of OPTESIM.

%Load experimental spectrum
spectrum = filterRaw(filename, filter_options);
%Define a model of one deuterium and one proton with a
%product rule
optmodel = eseOptModel({’H2’,’H1’}, ’1*2’);
%Set the nulcear parameters for Nucleus 1
optmodel = changeOptModelValue(optmodel,...
 ’eeqQ’, 1, 0.2, ’eta’, 1, 0.1);
%Set the nulcear parameters for Nucleus 2
optmodel = changeOptModelValue(optmodel,...
 ’eeqQ’, 2, 0.2, ’eta’, 2, 0.1);
%Register variables for Optimization
%Parameter, nucleus number, index, min value, max value
optmodel = registerOptModelVariable(optmodel,...
 ’Aiso’, 1, 1, -10, 10, ...
 ’r’ , 1, 2, 0, 10, ...
 ’Aiso’, 2, 3, -10, 10, ...
 ’r’ , 2, 4, 0, 10);
%Set initial values for
%Aiso1, r1, Aiso2, r2, respectively
x = [6.5, 2.5, 1.5, 2.5];
%Use simplex methods for optimization
options = optimset(’OutputFcn’, @esePlot, ’Display’, ’iter’);
x_opted = fminsearch(@eseOptObjective, x, options);