필터 지우기
필터 지우기

Best way to filter a Matrix

조회 수: 4 (최근 30일)
Daniel
Daniel 2011년 6월 29일
I have the postion, velocity and acceleration data from a subject walking. Each variable is a matrix with each column representing a step and each row representing a measurement. However, there are some bad values where VZ didn't record a position (ie 1; 2; 3; 0; 5) or the vaue is way off(ie 1; 2; 3; 1256; 5). I would like to create vectors for average step values for position, velocity and acceleration.
Whats the best way to create the vectors without the bad values?
I am having trouble with the finding the bad values and making the dimensions of the columns agree. Any help is greatly appreciated... Thanks.

채택된 답변

Paulo Silva
Paulo Silva 2011년 6월 29일
Maybe this can help you start with a smooth algorithm
po=[1 2 3 10 4 5 100 6 7 8 9 0 10 11 12 0 13 14 15 16]
p=po;
v=diff(p);
vp=find(abs(v)>2);
vp=vp(1:2:end);
p(vp+1)=(p(vp+2)+p(vp))/2;
t=1:numel(p);
plot(t,po,t,p)
legend('Measurements','Filtered measurements')
p
  댓글 수: 3
Daniel
Daniel 2011년 7월 5일
Thank you for yor help... I was unabe to replace bad values with averages. I placed limits on the variables and it worked okay.
Paulo Silva
Paulo Silva 2011년 7월 5일
I just remember something that might be useful for the same purpose, it's the rate limiter from simulink, http://www.mathworks.com/help/toolbox/simulink/slref/ratelimiter.html , you can use the documentation formulas on your problem.

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

추가 답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 6월 29일
Do you have the curve fitting toolbox? If so, look at:
doc smooth
specifically the 'rlowess' option.
Are all three signals recorded or do you just have acceleration or just position? Assuming you only have one of the signals, do the smoothing before any differentiation or integration.
  댓글 수: 1
Daniel
Daniel 2011년 6월 29일
I do not have the curve fitting toolbox...
I have position, velocity and acceleration data. I was not present at the recording. When I try to filter the data before other calculations (sparating the data by step and task) it takes longer and I run into the same problems.

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


Andrei Bobrov
Andrei Bobrov 2011년 6월 30일
my variant
pf = [po(1)-1 po po(end)+1];
p = median(pf(bsxfun(@plus,1:3,(0:length(pf)-3)')),2);
  댓글 수: 1
Daniel
Daniel 2011년 6월 30일
I am using your code and the code posted above. It is tricky because there can be multiple consecutive bad values.
http://i3.photobucket.com/albums/y80/griffdrc/Graph.jpg
I need to creat graphs like the ones in Figure C and D.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by