For an example (more complicated than you need, but should be easy enough to understand), see constrained minimization using ga.
Alan Weiss
MATLAB mathematical toolbox documentation
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!