Data normalization with threshold

10 Ansichten (letzte 30 Tage)
MattC
MattC am 5 Mär. 2023
Kommentiert: Star Strider am 5 Mär. 2023
Hi, I am interested in normalizing my data between 0 and 1. However, I do have a threshold value/limit value that I would like to use while normalizing. Example: data: [10,30,50,75], threshold value: [70]. Good data is when it does not exceed 70. I am not sure how to incorporate this threshold while normalizing data. Please help

Akzeptierte Antwort

Star Strider
Star Strider am 5 Mär. 2023
I am not certain what you want to do.
Perhaps one of these —
data = [10,30,50,75];
threshold_value = [70];
Result = normalize(data(data<=threshold_value), 'range',[0 1]) % Scale Only The Data To Be Considered
Result = 1×3
0 0.5000 1.0000
B = [70 1; 0 1] \ [1; 0]; % Scaling Parameters
Result = [data(data<=threshold_value).' ones(size(data(data<=threshold_value).'))] * B % Scale [0 70] —> [0 1]
Result = 3×1
0.1429 0.4286 0.7143
The first scales only the data that are less than 70 to [0 1]. The second scales [0 70] to [0 1], regardless of the data, although both limit the data to [0 70].
.
  20 Kommentare
MattC
MattC am 5 Mär. 2023
Thank you for all the help @Star Strider. If there a way I could put in a recognition for helping me solve this problem I would :)
Star Strider
Star Strider am 5 Mär. 2023
As always, my pleasure!
Accepting and voting for it is enough. Reputation points are how recognition is provided.
This will also be for other people with similar problems. For my part, I wrote the ‘Scaled’ anonymous function that I expanded to an anonymous function that can do a bivariate linear regression in a single line.
I also edited the code in my previous Comment so that the ‘ScaledResult’ table now has row names for ‘A’-‘C’, with the variable names being the days. I originally set it up for the earlier data, and now with different single data it needs to have a different format. The code in that Comment is otherwise unchanged.
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by