필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Increasing value of filter till required number of solutions each reached

조회 수: 1 (최근 30일)
Afzal
Afzal 2013년 3월 21일
마감: MATLAB Answer Bot 2021년 8월 20일
I need a while loop to increase the length, n, of a filter until I have 8 values that satisfy a result. The code that I have does not seem to work.
index = [];
while length(index)>8
n = 1;
filtered_ipam_relative_hand_position = moving_average_filter(ipam_relative_hand_position, n);
velocity=zeros(size(filtered_ipam_relative_hand_position));
for i=1:length(data)
for j= 1:3
x = i-1;
y = i+1;
if x == 0
x = 1;
else
if i == length(data)
y = length(data);
end
end
velocity(i,j) = (filtered_ipam_relative_hand_position(y,j)- filtered_ipam_relative_hand_position(x,j))/0.08;
end
end
magnitude_velocity = zeros(length(velocity),1);
for i=1:length(data)
magnitude_velocity(i)=((velocity(i,1))^2 + (velocity(i,2))^2 + (velocity(i,3))^2)^0.5;
end
for i=1:length(data)-1
if (magnitude_velocity(i+1,1)<0.01) && (magnitude_velocity(i,1)>0.01)
index = [index i];
end
end
n=n+1;
end

답변 (1개)

Walter Roberson
Walter Roberson 2013년 3월 22일
length([]) is 0, which is <= 8, so your "while" loop never executes.
  댓글 수: 2
Afzal
Afzal 2013년 3월 23일
How should I define 'index' then?
Walter Roberson
Walter Roberson 2013년 3월 26일
The problem is not your definition of "index", the problem is your "while" condition.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by