%% Optimization Options
%% Specify model and simulate data

Mdl0 = garch('ARCH',0.2,'GARCH',0.5,'Constant',0.5);
rng(1); 
y = simulate(Mdl0,500);

%
%% Set optimization options

options = optimoptions(@fmincon,'Diagnostics','on','Algorithm',...
    'sqp','Display','off','ConstraintTolerance',1e-7)
% @fmincon is the function handle for fmincon

%
%% Fit the model to the data

Mdl = garch(1,1);
EstMdl = estimate(Mdl,y,'Options',options);

% Copyright 2012 The MathWorks, Inc.