Filtering the data according to the time stamp

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by