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

Thread Subject:
Normalize matrix data to -1 to 1

Subject: Normalize matrix data to -1 to 1

From: Ed Chum

Date: 12 Apr, 2011 21:13:04

Message: 1 of 6

Hi, I have a matrix of 100s of rows with 16 columns. Each column has a different range of values, some from 0 to 0.5, others 0 to 5 and 0 to 700,000.

I want to normalise the values in each column such that they are in the range -1 to 1 relative to each column.

I know that applying normc will normalise the data to between 0 and 1 but is there a way to normalise to -1 to 1?

This is my first question and I have just started using matlab.

Subject: Normalize matrix data to -1 to 1

From: Frank

Date: 12 Apr, 2011 21:35:34

Message: 2 of 6

If all your columns are truly 0 to some number, then one way is...

>> norm_data = bsxfun(@rdivide,data,max(data)/2)-1;

Subject: Normalize matrix data to -1 to 1

From: Ed Chum

Date: 12 Apr, 2011 21:51:05

Message: 3 of 6

> If all your columns are truly 0 to some number, then one way is...
>
> >> norm_data = bsxfun(@rdivide,data,max(data)/2)-1;

The above does produce a new matrix with values -1 to 1, so does this function normalise for each column and keeps the relative scaling for each column?

Subject: Normalize matrix data to -1 to 1

From: Frank

Date: 12 Apr, 2011 22:11:04

Message: 4 of 6

On Apr 12, 4:51 pm, "Ed Chum" <eddiec...@hotmail.com> wrote:

> The above does produce a new matrix with values -1 to 1, so does this function normalise for each column and keeps the relative scaling for each column?

Each column should have values between -1 and 1, so yes...

Subject: Normalize matrix data to -1 to 1

From: Ed Chum

Date: 12 Apr, 2011 22:20:18

Message: 5 of 6

Thank you very much Frank, your replies were very prompt and helped me enormously.

Subject: Normalize matrix data to -1 to 1

From: Konstantine

Date: 4 May, 2011 01:40:05

Message: 6 of 6

Hi!
How would one do this if the data doesn't like between 0 and infinite, but instead includes negative numbers as well?

Thank you in advance.

Frank <fbleahy@yahoo.com> wrote in message <26b45c4a-8789-4163-84dc-9b7fbcff4b17@z3g2000prz.googlegroups.com>...
> If all your columns are truly 0 to some number, then one way is...
>
> >> norm_data = bsxfun(@rdivide,data,max(data)/2)-1;

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us