This model is based on Intermediary Asset Pricing by Zhiguo He and Arvind Krishnamurthy.
Solvingmodelmain_aeaweb.m is the code to solve for the equilibrium price/dividend ratio and plot the basic model implied functions. It uses the ode function delefully2hw15s.m.