% optimization code
dos('rm -rf check.*');
dos('rm -rf Opt_Info.txt');
% the initial values of parameters
Para0(1) = 0.1;   % Phi0                  
Para0(2) = 430;   % Sig0
Para0(3) = 1500;  % hs
Para0(4) = 430;   % k
Para0(5) = 400;   % b
Para0(6) = 0.5;   % n

% the lower bound of the parameters
ParaL(1) = 0.1;   % Phi0                  
ParaL(2) = 430;   % Sig0
ParaL(3) = 1000;  % hs
ParaL(4) = 200;   % k
ParaL(5) = 200;   % b
ParaL(6) = 0.2;   % n

% the upper bound of the parameters
ParaU(1) = 10.0;    % Phi0                  
ParaU(2) = 430;     % Sig0
ParaU(3) = 3000;    % hs
ParaU(4) = 800;     % k
ParaU(5) = 1500;    % b
ParaU(6) = 0.7;     % n

[Para fval] = fminsearchbnd(@AbaqusAllResult, Para0, ParaL, ParaU)
Coef = [];
b = [];
Aeq = [];
beq = [];
nonlcon = [];

Abaqusname=['Opt'];
% record the Optimized Parameter information
FidInf = fopen([Abaqusname '_Info.txt'],'a');
fprintf(FidInf, 'Optimal Phi0: %12.5E \n', Para(1));
fprintf(FidInf, 'Optimal Sig0, hS and k: %12.5E, %12.5E, %12.5E \n', Para(2), Para(3), Para(4));
fprintf(FidInf, 'Optimal b and n: %12.5E, %12.5E \n', Para(5), Para(6));
fprintf(FidInf, 'Optimal MSE is %12.5e \n', fval);
fclose(FidInf);