How to normalize time periods

조회 수: 44 (최근 30일)
Hinde essmahi BOUZIANE
Hinde essmahi BOUZIANE 2019년 6월 20일
댓글: Aravind Ravikumar 2019년 6월 20일
I am very new to matlab and I don't know how to code this problem.I have two arrays: Debut and End. Each array contains doubles that indicates the start(Debut) or the end(End) of a certain period.I am doing some signal processing so I want all these periods be normalised. I am thinking of calculating the mean of all periods and then normalize each period to that mean ? or do you have any other ideas ?

채택된 답변

Aravind Ravikumar
Aravind Ravikumar 2019년 6월 20일
편집: Aravind Ravikumar 2019년 6월 20일
MATLAB has a normalize function, you can view the documentation here. From your description of your problem, you can first calculate the mean of the arrays Debut and End element-wise and then use normalize() on the resultant array. For example, the following code does somewhat similar to what you want:
x = rand(1,10);
y = rand(1,10);
avg = (x+y)/2;
norm_avg = normalize(avg);
where x,y are 2 arrays, avg is the element-wise average of x,y and norm_avg is the result after using normalize() on avg.
  댓글 수: 6
Hinde essmahi BOUZIANE
Hinde essmahi BOUZIANE 2019년 6월 20일
I tought about too that but i need to use each element of the array in an other function ' arguments.
Aravind Ravikumar
Aravind Ravikumar 2019년 6월 20일
You could keep normalized values of each array separately in some other array, and to calculate normalized value of the difference you can use the original array.
x = rand(1,10);
y = rand(1,10);
diff = y-x;
res_nor = diff ./ max(diff)
x_nor = x ./ max(x)
y_nor = y ./ max(y)
Maybe something like the above code.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Akshay Malav
Akshay Malav 2019년 6월 20일
Hi , there is a inbuilt function in matlab to normalize the data . Look at the link mentioned below .
The function is V = normalize(A)
V will contain the normalized value of the array A
  댓글 수: 3
Akshay Malav
Akshay Malav 2019년 6월 20일
Yes it is defined for double also
Akshay Malav
Akshay Malav 2019년 6월 20일
Ans also adding to above answer the normalize function ignores NaN values if it is present in your array

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by