In this tutorial, Charles Marchini uses MATLAB to show how a function is shifted when a constant is subtracted from the independent variable. The same method can be used to show how a function is compressed or stretched when the independent variable is multiplied by a constant.
This video is supported by the National Science Foundation under grant 1735252. https://minibrain.beckman.illinois.edu/