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

The first problem is that $\displaystyle 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 $\displaystyle xb$, $\displaystyle p$, $\displaystyle \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 $\displaystyle s_j$ so I can just type $\displaystyle s_j$ in fsolve? $\displaystyle s_j$ appears several times in the $\displaystyle \Delta$ matrix, which if I type it out could easily be stretched really long.

Thanks!