Assuming you already know the numerical values of rho, P(K-1), alpha, r0, r, and the function f(x,r), you should be able to solve for d0 with the use of matlab’s ‘fzero’. For that purpose you need to create a function for use in ‘fzero’ which computes the difference in both sides of your equation for input values of d0. Using this you can make a plot of this function’s values as d0 varies and note where it crosses zero. Then you can pick two points on either side of the crossing point and set ‘fzero’ to work with those two points as your initial two-point estimate and locate the crossing point with accuracy. Of course the above function will have to call on matlab’s ‘integral’ function three times for each evaluation.