フィルターのクリア

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 Center および File ExchangeBartlett についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by