Normalize data with a threshold

조회 수: 11 (최근 30일)
Isura1992
Isura1992 2017년 1월 29일
답변: Walter Roberson 2017년 1월 29일
The graph shows a set of normalized data that i have, from 0 to 1. My process is to put this normalized data set into a colormap in grayscale and show the peaks in white and zeros in black as a nice scale. My problem is that the outliers on the two end of the data set. They turn the colormap complete black and only the ends of the set show some peaks in white. I would like to add a upper limit/threshold on the dataset? if you can understand.
example:
normalized Output that i am looking for it min=2.5 max=7.5
Data = [ 0 1 4 5 8 10 ]
Norm = [ 0 0 0.3 0.5 1 1 ]
All values above 7.5 would be given a 1 and below 2.5 would be be 0. Something like this!
Thank you for your valuable time,
I am new to matlab!

답변 (1개)

Walter Roberson
Walter Roberson 2017년 1월 29일
min_at = 2.5;
max_at = 7.5;
New = max( min( (Data - min_at)./(max_at - min_at), 1), 0)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by