- Use the “rescale” function provided by MATLAB to scale the values between any given range [a,b]. You can read more about the “rescale” function using the following MathWorks documentation link: https://www.mathworks.com/help/matlab/ref/rescale.html
- Otherwise, you can use the calculated mean and standard deviation to scale the values as shown below.
How to normalize the values of a dataset of 32X8X2X15000 in the range -0.5 to 0.5 using standard deviation
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
If I have dataset of 4D single with size 32X8X2X15000. And I have calculated the mean and standard deviation of thart particular dataset. Now I want to bring all the values of the dataset within the range -0.5 to 0.5. How to do that
0 Kommentare
Antworten (1)
Udit06
am 29 Aug. 2023
Hi Anusaya,
I understand that you are trying to scale your data present in the 4-D matrix so that it falls in the range [-0.5, 0.5]. You can try out the following two approaches to scale your data:
% Assuming your dataset is stored in a variable called 'data'
data = rand(32, 8, 2, 15000) % your 4D dataset with size 32x8x2x15000
% Calculate the mean and standard deviation
mu = mean(data(:));
sigma = std(data(:));
% Normalize the dataset within the range -0.5 to 0.5
normalized_data = (data - mu) / (2 * sigma);
normalized_data = normalized_data * 0.5;
% Clip values outside the range -0.5 to 0.5
normalized_data = max(min(normalized_data, 0.5), -0.5);
% Verify the range of the normalized data
min_val = min(normalized_data(:));
max_val = max(normalized_data(:));
disp(['Minimum value: ', num2str(min_val)]);
disp(['Maximum value: ', num2str(max_val)]);
I hope this helps.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Hypothesis Tests finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!