Filtering the data according to the time stamp

1 回表示 (過去 30 日間)
ASMS Mat Su
ASMS Mat Su 2011 年 11 月 20 日
I would like to filter this data according to the time stamp i.e for the first three second of the time, and take average of Elevation and Speed at 0, 1, 2 and 3 sec.
OR take average for the first three second each time, and return one mean value for each parameters.
What is the appropriate function?
Anyone expert on this?
Let say matrix of A =
Time, s Elevation Speed
0 23.9 0.28
0 23.9 0.28
0 23.9 0.28
0 23.9 0.28
1 23.9 0.28
1 23.9 0.28
1 24.7 0.28
1 24.7 0.28
1 24.7 0.28
1 24.7 0.28
2 24.7 0.28
2 24.7 0.28
2 24.7 0.44
2 24.7 0.44
3 23.1 0.44
3 23.1 0.44
3 23.1 0.44
3 23.1 0.44
3 23.1 0.44
3 23.1 0.44

回答 (1 件)

Kostas
Kostas 2011 年 11 月 20 日
Sure not the most "efficient" solution but could work smt like that
k=0;
for i=0:3 % loop over the seconds
id=find(A(:,1)==i); %get indices where you find the time you want
if ~isempty(id)
k=k+1;
elev_mean=mean(A(id,2)); %mean value of parameter elevation
s_mean=mean(A(id,3)); %mean value of parameter time
m_values(k,:)=[i elev_mean s_mean];
end
end
  1 件のコメント
ASMS Mat Su
ASMS Mat Su 2011 年 11 月 28 日
Thanks Kostas;
Its not working...How about this...
n = 5; % Number of filtered data
t = max (A(:,1)); % max total Time,s
k=1;
for i=0:t; % Loops for time t=0 to t=Max
ind = find(A(:,1)==i);
X = EC(ind(1:n),1:3);
disp (X);
Y = mean(A(ind(1:n),2:4));
k=k+1;
end
but then I have another problem! I want to get every single X stored e.g for the first 2 row at t=0,1,2,3...

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDigital and Analog Filters についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by