Normalize different size arrays to all be 100 points long with resample

조회 수: 18 (최근 30일)
I am trying to normalize gait data to the gait cycle for a bunch of subjects. Each subject has a different length gait cycle. For example, if one subject has 115 data points over the gait cycle, another has 150. All data is collected at the same frequency. I would like to normalize the data so I have 100 points over the gait cycle for every subject. This is done for 50 subjects, so I would like to be able to normalize without inputting how long the current data set is. I was trying to play around with the resample function but can't figure out how to get the parameters correct. Advice?

채택된 답변

Star Strider
Star Strider 2019년 9월 27일
Using resample (or any other interpolation method, although resample is best for signal processing applications) to get the same number of data for each subject risks having a different sampling frequency for each subject. This also means that any signal processing you do (such as filtering) would have to be individualised for each subject, as would subsequent data analysis. So I would advise against that.
You could likely do it by using the ‘p’ and ‘q’ parameters as the integer values of the actual and desired record lengths, since resample just needs those values to change the sampling frequency (and record length) of the argument vector. (It cares not one whit what the numbers actually represent.) However for the reasons I already mentioned, this is unadvisable.
Use cell arrays to store the varying-length records, with the same sampling frequency for all of them, and then use the same analytical techniques for every subject.
  댓글 수: 4
husnir nasyuha
husnir nasyuha 2021년 3월 9일
hi may is ask, what if the signals have different sampling rates?
Star Strider
Star Strider 2021년 3월 9일
husnir nasyuha — I would consider using resample first to get them all to have the same sampling frequency, the do the rest as explained here. Understand the hazards involved in doing that, though.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by