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

17 Solutions

9 Solvers

Last Solution submitted on Feb 17, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...

Problem Recent Solvers9

Suggested Problems

More from this Author19

Community Treasure Hunt

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

Start Hunting!