Minimizing a nonlinear integral (in Matlab, I hope)

Ok, I think this is a pretty tricky one.

I'm trying to develop a script to minimize A in the following function. It looks like I want to use the fmincon() function, but I'm not really sure. I think I just need a push in the right direction...

(int((1-(1-x)^(1/(D1)))-x*(C1),z,0,h)-P1)^2+

(int((1-(1-x)^(1/(D2)))-x*(C2),z,0,h)-P2)^2+...

=A

So there's a different value of x for every z - I need it to be able to feed it a value for z and have it return the value of x that will minimize A.

There are eight given values for each of C D and P (as in, we have C1 though C8 along with eight different terms that need to be added)

Here are some conditions which are making this extra tricky:

1) x must increase as z increases, that is dx/dz is always positive

2) x must be positive at all points

3) x must be less than 1, and preferably less than 0.5

If anybody can help me with this, you really are the best person in the universe.

Thanks!

Canopy