https://www.mathworks.com/help/finance/bond-prices-and-yield-curve-nonparallel-shifts.html
Bond Prices and Yield Curve Nonparallel Shifts - MATLAB & Simulink
This example shows how to construct a bond portfolio to hedge the interest-rate risk of a Treasury bond maturing in 20 years.
bond pricesyield curvenonparallelshiftsmatlab