필터 지우기
필터 지우기

Data normalization with threshold

조회 수: 9 (최근 30일)
MattC
MattC 2023년 3월 5일
댓글: Star Strider 2023년 3월 5일
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