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

on 13 May 2013

### José-Luis (view profile)

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.

## Products

No products are associated with this question.

### José-Luis (view profile)

on 15 May 2013

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

Platon

### Platon (view profile)

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)

José-Luis

### José-Luis (view profile)

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)
```

### Jurgen (view profile)

on 15 May 2013

```NDATA = mat2gray(DATA);
```

#### Join the 15-year community celebration.

Play games and win prizes!

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