MATLAB Answers


How can I normalize data between 0 and 1 ? I want to use logsig...

Asked by Platon
on 13 May 2013

All is in the question: I want to use logsig as a transfer function for the hidden neurones so I have to normalize data between 0 and 1. The mapminmax function in NN tool box normalize data between -1 and 1 so it does not correspond to what I'm looking for.



No products are associated with this question.

2 Answers

Answer by José-Luis
on 15 May 2013
 Accepted answer

 bla = 100.*randn(1,10)
 norm_data = (bla - min(bla)) / ( max(bla) - min(bla) )


on 15 May 2013

Thank you for your response. But if I do the normalization manually and train the NN with the normalized data, how can I test the net with new data? normalize them before simulation? if so how can I de-normalize the output calculated from unseen data? It seems complicated (mapminmax do all the stuff automatically)

on 15 May 2013

Yes, provided you use the same normalization bounds (the min and max of both datasets). To rescale, please look at the below code.

bla = 100.*randn(1,10)
minVal = min(bla);
maxVal = max(bla);
norm_data = (bla - minVal) / ( maxVal - minVal )
your_original_data = minVal + norm_data.*(maxVal - minVal)

Answer by Jurgen
on 15 May 2013

NDATA = mat2gray(DATA);


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!