Scaling up a default output range between 0 & 1 to a different output range in Matlab

11 views (last 30 days)
I have a code displaying a default output range between 0 & 1, but I need it to give me different output range which can be obtained when the required range is specified. For example, rather than having output values between 0 & 1 alone, how can I write a code that will give output values between 10 & 20, where 10 is the lower limit and 20 is the upper limit.
The code will include the lower & upper limit such that when these are supplied, it displays the result within the specified limit. The code takes the output range between 0 & 1, and scales it up to a general lower and upper limit which can be obtained when the values are specified.

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 17 Sep 2013
Edited: Azzi Abdelmalek on 17 Sep 2013
v=100:0.1:150 % your signal
min1=10
max1=20
out = min1 + (max1-min1)*(v-min(v))/(max(v)-min(v));

Community Treasure Hunt

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

Start Hunting!