フィルターのクリア

find intersection between two data sets

5 ビュー (過去 30 日間)
Carlos A. Morales Rergis
Carlos A. Morales Rergis 2013 年 9 月 26 日
I have a random signal, and somehow a zone where a study is going to be made, lets think about a circle representing the limit of this zone, If I want to know which of the samples of my signal is the first one inside the circle zone, Is there a function in Matlab that helps me in this task.
If it is not, what would you recomend to do this...
Saludos!

採用された回答

Sven
Sven 2013 年 9 月 26 日
Hi Carlos, try this code:
dataset = rand(20,2);
zoneXY = rand(1,2);
zoneRadius = rand(1);
dists = sqrt(sum(bsxfun(@minus, dataset, zoneXY).^2,2));
inZone = dists < zoneRadius;
figure
plot(dataset(:,1),dataset(:,2),'.'), hold on
rectangle('Position',[zoneXY-zoneRadius zoneRadius*2 zoneRadius*2],'Curvature',[1 1])
if any(inZone)
firstInZone = find(inZone,1,'first')
plot(dataset(firstInZone,1),dataset(firstInZone,2),'gs')
legend({'Data points','First Pt In Zone'})
end
Does it describe your problem and how to find an answer?
  1 件のコメント
Carlos A. Morales Rergis
Carlos A. Morales Rergis 2013 年 9 月 30 日
Perfecto!!! Muchas gracias...
thanks a lot!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWaveform Generation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by