Two possible ways:
1) switch to fmincon and for the variables that are to be constants, set their lb and ub to be the same constant
2) construct an anonymous function that takes in a vector of length (e.g.) 75, and creates a new vector of length 100 with the remaining locations filled with the constants. For example,
ReOrder = @(Vector, NewOrder) Vector(NewOrder);
this_objective = @(x) original_objective_function ( ReOrder( [x(:), ConstantParameters(:)], ProperOrder) );
ProperOrder would be a vector indicating for first the (e.g.) 75 parameters and then the (e.g.) 25 constants, where each one goes in the order expected by original_objective_function. For example if you had a logical vector Treat_As_Constant then
ProperOrder = [find(~Treat_As_Constant(:)); find(Treat_As_Constant)];
Best Answer