Problem 61151. Scaling vertically functions

Given a real function by the 1×n array, x, of inputs and the 1×n array, y, of outputs, consider shifting vertically its graph by the scale factor k (see figure below). Return
  • y_scaled, which is the 1×n vector that stands for the outputs of the scaled function;
  • s = 'strech' or 'compress', if the graph will be away from or towards the x-axis, respectively, becoming narrower or wider relative to the original function's graph. Return s = '', if there is no change in size;
  • r = 'flip' or 'flat' if the graph will be reflected over the x-axis or collapses the entire graph onto the x-axis, respectively. Return r = '', if the orientation is preserved.
input: (x, y, k)
output: [y_scaled, s, r]
Scaling function's graph

Solution Stats

75.0% Correct | 25.0% Incorrect
Last Solution submitted on Jan 12, 2026

Solution Comments

Show comments

Problem Recent Solvers2

Suggested Problems

More from this Author14

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!