Need Matlab code for matrix normalization

Status
Not open for further replies.

jayita

Newbie level 3
Joined
Mar 23, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
romania
Activity points
1,305
Hallo,
I have a N*20 matrix where N is no of rows and 20 is the no of colums.I want to normalize this matrix within 0-1 range using sigmoid function.Can anone show me the code in matlab because I m new in matlab.

Thank u.
Jayita
 

Re: matrix normalization

Could you explain would is a "sigmoid-function"

Form my understanding normalization could restrict rows or colums or both to

[-1,1]

but how to restrict to

[0,1] ?
 

Re: matrix normalization

I have to replace each element x of the matrix by 1/(1+exp(-x))
 

Re: matrix normalization

Let's call A your MxN matrix:

the code is:

m = 1 + exp(-A);
k = ones(M,N);
B = k./m;

k is a MxN matrix in which each element is 1
the ./ operator defines the element-wise division
B is the matrix in which each element is calculated as 1/(1+exp(-x)). Of course you can also use the compact form:

B = ones(M,N)./(1+exp(-A));
 

matrix normalization

Im not sure about this solution, but lets get it try

N = 20; M = 20;
x = rand(N,M);

sigmoidX = 1./(1+exp(-x));

U'll see the different, ..but if need to normalize again the data tobe maximum 1, ..then compress the data use

sigmoidX = 1./(1+exp(-x));
sigmoidX_norm = sigmoidX./max(sigmoidX));

U'll see it if plot the data, ..

figure,
subplot(131),imshow(x)
subplot(132),imshow(sigmoidX)
subplot(133),imshow(sigmoidX_norm)

Hope it Works, ..
 

Re: matrix normalization

Thank u so much....but can anyone tell me how i can call my matrix.i have my matrix with me.but whenever i load it gives me error......for reference i attach my matrix.
 

Re: matrix normalization

Sorry, but I didn't clearly understand your question. However, if you just want to enter a matrix inputting the numbers you can follow this example:

if, for instance the matrix "A" 5x3 is:

1 2 3
4 5 6
7 8 9
10 11 12
13 14 15

then in Matlab

A=[1 2 3;4 5 6;7 8 9;10 11 12;13 14 15];

that means: numbers on different columns are separated by space and numbers on different rows are separated by semicolon (
 

Re: matrix normalization

I have my N×20 matrix.i just want to call it first then want to normalize it.
HOw can I call my matrix?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…