Data normalization with threshold

11 次查看(过去 30 天)
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

采纳的回答

Star Strider
Star Strider 2023-3-5
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 个评论
MattC
MattC 2023-3-5
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 2023-3-5
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.
.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by