필터 지우기
필터 지우기

making different signals equal in length

조회 수: 3 (최근 30일)
Lisa Justin
Lisa Justin 2012년 12월 3일
댓글: chaitanya 2016년 2월 27일
Hi, I am working with a set of data and i need all of them to be the same length. how can i do this?

채택된 답변

Jan
Jan 2012년 12월 3일
It depends. As said already you can crop the longer ones, pad the shorter ones or apply an interpolation. For the latter there are linear, cubic, spline, bsline, trigonometric and more complicated interpolation methods.
  댓글 수: 2
aliya
aliya 2015년 6월 1일
편집: aliya 2015년 6월 1일
What if we have multiple signals from a database of different sizes. how to make their length equal?
Walter Roberson
Walter Roberson 2015년 6월 1일
Find the maximum of their lengths, say maxlen. Then for each,
ifft(fft(TheSignal),maxlen)

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

추가 답변 (2개)

Walter Roberson
Walter Roberson 2012년 12월 3일
S1 = size(FirstMatrix);
S2 = size(SecondMatrix);
MaxS = max(S1, S2);
if MaxS(1) > S1(1); FirstMatrix(end+1:MaxS(1), :) = 0; end
if MaxS(2) > S1(2); FirstMatrix(:, end+1:MaxS(2)) = 0; end
if MaxS(1) > S2(1); SecondMatrix(end+1:MaxS(1), :) = 0; end
if MaxS(2) > S2(2); SecondMatrix(:, end+1:MaxS(2)) = 0; end
You can simplify this a bit if you are using vectors and you know the orientation of the vectors.
  댓글 수: 3
Lisa Justin
Lisa Justin 2012년 12월 3일
편집: Lisa Justin 2012년 12월 3일
yes exactly. But then i lose some relevant part of the signal which is not good either. I am a bit unsure how best to make all the length equal. they are about 600 files
chaitanya
chaitanya 2016년 2월 27일
thanks..it is useful

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


Muruganandham Subramanian
Muruganandham Subramanian 2012년 12월 3일
Can you provide the data? you can do it by adding zeros, ones, any desirable data to the data having minimum sizes from data having maximum sizes by initializing max. data length caustiously..

카테고리

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