How to obtain samples within angular windows?
2 ビュー (過去 30 日間)
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.
回答 (1 件)
Jyotish Robin 2017 年 1 月 20 日
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!!