Scaling up a default output range between 0 & 1 to a different output range in Matlab
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
1 commentaire
Matt Kindig
le 17 Sep 2013
% 'output' is between 0 and 1
lower = 10;
upper = 20;
scaled = lower + (upper-lower)*output.
Réponses (1)
Azzi Abdelmalek
le 17 Sep 2013
Modifié(e) : Azzi Abdelmalek
le 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));
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!