This simulates a bond ladder using Treasury Inflation Protected Securities (TIPS).
Suppose you have $1 million dollars to invest. This calculates your income if you buy TIPS that mature in 1 year, TIPS that mature in 2 years, etc, so that an equivalent value (inflation-adjusted) of bonds matures each year. For example, if you set years to 30, and the output is 4.2%, you can receive $1 million * .042 = $42,000 per year, in today's dollars, for 30 years.
This is just an approximation. We use the 10-year real yield provided by the Treasury Department, but bonds maturing in different years may have different yields.
A ladder of Treasury Inflation Protected Securities will allow you to withdraw approximately 4.5% per year.