This MATLAB code demonstrates how to delay and advance a sequence x(n) by a unit k. It prompts the user to input values for p, q, the delay/advance k, and the sequence x(n). It then generates plots with the original x(n) on top and the delayed/advanced sequence ym on bottom, labeling each appropriately. The delay inserts zeros at the beginning of x(n) equal to k. The advance inserts zeros at the end of x(n) equal to k.