For 3-D MINIMIZATION Problems
You should adapt the code for multi-dimensional (N-D) problems.
The code use anonymous functions for the optimization. Some test functions are provide for tests.
de Castro, L. N., and Von Zuben, F. J. Learning and Optimization Using the Clonal Selection Principle. IEEE Transactions on Evolutionary Computation. v. 6(3). 2002. DOI: 10.1109/TEVC.2002.1011539
Optimized and corrected some serious problems. Maximization code removed.