Hi, I'm trying to use the fsolve function in Matlab to solve a system of equations for \mathbf{p}: \mathbf{s} - \mathbf{\Delta} (\mathbf{p} - \mathbf{mc}) = \mathbf{0} where \mathbf{s} is a nonlinear function of \mathbf{p} and \mathbf{\Delta} is a function of \mathbf{s}.

The first problem is that s_j = \exp( xb_j - \alpha \cdot p_j + \xi_j ) / ( 1 + \sum_k \exp( xb_k - \alpha \cdot p_k + \xi_k ) ) and I'm not sure how to include summation into the inline() function in Matlab.

The second problem is that I will be doing lots of these estimation at once. Specifically, I have a huge vector of xb, p, \xi, but I have to do the fsolve piece by piece. Therefore, the range of the summation would be a condition based on some other characteristics from the data. How would I include the condition part?

Lastly, is there a way to define function s_j so I can just type s_j in fsolve? s_j appears several times in the \Delta matrix, which if I type it out could easily be stretched really long.

Thanks!