MATLAB: How can i write an objective function with 10 variables and each variable having constraints

functionoptimization

I am trying to optimize a function using Particle Swarm Optimization,and the function which I have to optimize have 10 variables, with each having a lower and upper bound. I want to know how i can write such an objective function. Do I have to put the constraints in the main algorithm or in the objective function file??
Related Question