% RequireFEXpackageExample1- script demonstrating how 
% the function 'requireFEXPackage' can be used to add (on demand) 
% other FEX submission on which your submission relies. 
% This example uses the 'exist' command.
% 
% (C) Igor Podlubny, 2011



% first, somewhere in the very beginning of your code,
% check if the function 'fminsearchbnd' from the FEX package 8277 
% is on your MATLAB path, and if it is not there, 
% require the FEX package 8277:
if ~(exist('fminsearchbnd', 'file') == 2)
    P = requireFEXpackage(8277);  % fminsearchbnd is part of 8277
end


% Then just use 'fminsearchbnd':
syms x
RosenbrockBananaFunction = @(x) (1-x(1)).^2 + 100*(x(2)-x(1).^2).^2;
x = fminsearchbnd(RosenbrockBananaFunction,[3 3])



