필터 지우기
필터 지우기

Filtering the data according to the time stamp

조회 수: 2 (최근 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 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