LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

normalise array to values between 0 and 1?

Is there are .vi in labview that will allow me to normalise an array of data to values that are between 0 and 1? if not, does anyone know the calculation that will allow me to do this?

0 Kudos
Message 1 of 8
(16,904 Views)

ok nvm, worked it out. its a + (x-A)*(b-a)/(B-A) where:

 

A minimum of dataset

B maximum of dataset

a is from where you would like normalised data set to start

b is where you would like normalised data set to end

x is the value you are trying to normalise

 

found it at this website http://www.howcast.com/videos/359111-How-To-Normalize-Data

0 Kudos
Message 2 of 8
(16,891 Views)

Hi LVStudent,

 

To normalize a waveform you can run a search for "Normalize Waveform.vi" or in the function palette-->Programming-->Waveform-->Analog Waveform--> Normalize.

Hope it'll let you avoid implementing this: a + (x-A)*(b-a)/(B-A).

 

0 Kudos
Message 3 of 8
(16,879 Views)

Firstly, normalize waveform will scale a waveform to [-1..1] and not [0..1] and the OP asked for an array operation, not a waveform operation. Both are incorrect answers.

 

Here's how you would scale an array from 0..1. If you want, you can turn this into a subVI. 🙂

 

 

Message 4 of 8
(16,869 Views)

On a side note, I wish NI would get their terminology straight here. For example:

 

 

  1. Normalize waveform: scales a waveform from -1..1
  2. Normalize VI: normalizes an array so the statistical profile has a mean of 0 and SD of 1.
  3. Scale VI: scales an array from -1..1.
  4. Waveform scale and offset: Does again something entirely different.... equivalent to linear evaluation!
1 and 2 are very different, but have similar names.
1 and 3 do basically the same, but have different names....
etc.
sigh!

 

0 Kudos
Message 5 of 8
(16,851 Views)

After you posted your first response, I looked up the algorithms/formulas in use and 1&2  are, indeed, very different.

How innocent of me to think that they are all the same....

From my experience, which isn't much, we use #2 and not/never [-1...1], but I guess it depends on the application/discipline.

0 Kudos
Message 6 of 8
(16,848 Views)

Just remember that this code assumes that all values in the array are positive. If your signal fluctuates below zero this will not work.

0 Kudos
Message 7 of 8
(7,223 Views)

@sam.blades wrote:

Just remember that this code assumes that all values in the array are positive. If your signal fluctuates below zero this will not work.


This is a long (and old!) thread and we have absolutely no idea what you mean by "this code". For clarity, you need to quote relevant parts of the post you are replying to. (e.g. my code makes no assumption about sign).

0 Kudos
Message 8 of 8
(7,220 Views)