필터 지우기
필터 지우기

How to obtain samples within angular windows?

조회 수: 2 (최근 30일)
OH
OH 2017년 1월 17일
댓글: OH 2017년 1월 21일
Hi, Let us say I have a projectile moving around in a square environment and I want to sample all positions where the projectile has travelled within a 20 degrees angular window, as seen from a fixed point in the environment. Can anyone help me figure out how to do this? In the attached picture, the spiral is a made up path of the projectile and the red dot is the fixed point from which I want to make the angular window.
Thanks
  댓글 수: 1
OH
OH 2017년 1월 18일
Ok, so if I construct vectors with 20 degrees separation emanating from the fixed point (as in the picture below), can I then somehow get all the non-NaN elements (i.e where the projectile has been) in the area between two vectors?

댓글을 달려면 로그인하십시오.

답변 (1개)

Jyotish Robin
Jyotish Robin 2017년 1월 20일
Hi,
Since you are asking for a way in which you can get the non- NaN elements, I suppose you are having a matrix which corresponds to the image. Let me know if that is not the case.
Now, I would suggest you to make use of the function "isnan". isnan(A) returns an array with the same size as A containing logical 1 (true) where the elements of A are NaNs and logical 0 (false) where they are not.
So if it's just a 1D vector ( say y), you can simply do something like this:
>>y1 = y(~isnan(y));
You can read about this in detail in the below link:
Hope it helps!!
  댓글 수: 3
Image Analyst
Image Analyst 2017년 1월 21일
So, it's solved then?
OH
OH 2017년 1월 21일
I would say so.
If one also wants a vector with the sector identity for each
position sample, one may add the following to the example above:
sectorIdentity = (1:n) * sectorgrouping;
Thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by