Hi Lotte,
As per my understanding, it seems you wish to rescale the original function, such that the new range falls between a given maximum and minimum (thereby preserving the ‘shape’ of the originally fitted function).
This can be achieved by a simple mathematical function, which translates and scales the original range. One such (continuous) function can be defined as:
This function maps the original range [min, max] to the new range [a,b]
Refer to the following example for implementing the same in MATLAB:
a_old = -1;
b_old = 1;
a = -0.2;
b = 0.8;
x=linspace(1,10);
y=sin(x);
y_transformed = (b-a)*(y-a_old)/(b_old-a_old) + a;
plot(x,y);
hold on
plot(x,y_transformed);
Plotted ranges (original and transformed)