In real life, notional amounts can get even more complicated than that. Generally, most libraries refer to non-constant notional as "amortizing notional". I will just list the use cases, to illustrate that many libraries (such as QuantLib) don't handle all commonuse cases.
Sometimes some (but not all) of the principal is prepaid ("amortized", or "sunk") before the instrument's maturity. As the result, the outstanding notional (or, equivalently, the factor applied to the initial notional) decreases. The interest is calculated on the remaining notional.
Sometimes the instrument (loan, bond, sawp leg...) is created with an amortization schedule, written in the term sheet or a similar documentation. Often the amortization schedule is calibrated so that the the net cash flow (the sum of the interest payment and the notional prepayment) is the same in every payment period. But some instruments (in particular, many mortgages and other loans) make (additional) partial pre-payment optional. Then the instrument's price (yield) and risks are affected by the likelyhood that the option to pre-pay will be exercised. The decision whether to exercise the option pre-pay, and how much, is mostly driven by risk-free interest rates, but also by many other factors. The option to pre-pay in part is more general/complicated than a callable/potable bind where the option is to repay all the remaining principal at once, not in part. Models that try to predict prepayment behavior based solely on interest rates, usually don't predict well. More sophisticated/holistic models usually predict prepayments better. Sometimes (rarely) the prepayment happens randomly by lottery.
For convenience, the notional prepayment almost always happens at the time of a coupon payment and affects the next coupon. But in reality, amortisations often happen in the middle of coupon period. A good library will support mid-period prepayments and will calculate accrued interest on the different notionals that were outstanding during the period.
Sometimes notionals increase rather than decrease:
Pay in Kind (PIK) means that instead of paying cash interest, the borrower gives more notional to the lender. Future coupons will be paid on higher notional, and eventually more notional will be paid back. Sometimes a PIK schedule is agreed at issuance (just like amortization schedule). For example, you might have a bond paying9% a year, but in the first year all 9% is PIK, in the second year 4.5% is PIK and the other 4.5% is cash interest, and in the later years all 9% is cash interest. Economically this example little different from a step-up coupon and an odd (very long) first coupon period. Sometimes high-yield borrowers have an option to PIK. Before a coupon is due to be paid, they announce that some or all of the coupon will be PIK rather than cash. The PIK is usually fixed, but sometimes floating (i.e. Libor + spread).
PIK is almost, but not quite like the opposite of amortization (so a library that handles it like "negative amortization" does not do so correctly). With amortization, the factor drops on the day when the notional is repaid and is constant between notional payments. In contrast, with PIK, the factor inceases every day that the PIK is accrued. A trade ticket (Bloomberg terminal function BXT) for a PIK bond swhowed two accrueds: the accrued cash interest and the accrued PIK.
Disbursements are a common feature of term loans. Suppose that a borrower needs USD 3 billion for a project, but does not need all this money in year 1. They agree that the lender will give USD 1 billion in each year 1, 2, 3 (contingent on various covenants being met) and only charge interest on the outstanding amounts. This is best modeled as a USD 3 billion dollar loan with factor 1/3, 2/3, 1 in years 1, 2, 3.
Revolver loans are like credit cards - the borrower has the option to draw and repay any time (up to their credit limit) and pays interest on the drawn amount.
Although it sounds complicated, it is possible to calculate a yield of any of these instruments. Just like with a vanilla bullet bond, you project, the best you can, all the cash flows (for the purposes of yields, just add up the interest and the notional payments), and solve for an internal rate of return that corresponds to discount factors on cash flow dates so that the sum of all the discounted cash flows (including the price you would pay) is 0. However the more optionality there is, the less certain are the cash flows and therefore the less certain the yield. In particular, in your examplel if the amortisations are optional, then you should use a model to project the amortizations, the best you can.