MATLAB: How to change a vector from [5 3 2 5 5 4 1 2] to [1 3 4 1 1 2 5 4] switching the scale from 1-5 to 5-1

MATLABvectors

Matlab textbook problem 2.33

Best Answer

x = [5 3 2 5 5 4 1 2];
y = 6 - x;