Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

hi :) I need help , I have an array of float angles , I want to find the indexes of angles in the range -pi/M<theta<=pi/M thanks

3 visualizaciones (últimos 30 días)
I try the following code:
(The problem is that this gives me also theta = -pi/M )
tolerance = 10^-4
M = 4;
thetaindxes_in_range = find(abs((abs(theta(:,1))-pi/M)<=tolerance));% theta

Respuestas (1)

Image Analyst
Image Analyst el 3 de Jun. de 2017
Then don't use abs(). Do each comparison separately. Like this:
M = 4;
indexesInRange = (theta > -pi/M) & (theta <= pi/M)
theta_in_range = theta(indexesInRange)
  3 comentarios
fatema hamodi
fatema hamodi el 3 de Jun. de 2017
sorry it's not working well because the following two lines code give the same result but they shouldn't give the same result because the second range contain also theta=-pi/M while the first didn't contain it
indexesInRange =(theta +pi/M>tol) & (theta-pi/M <= tol)
and
indexesInRange =(theta +pi/M>=tol) & (theta-pi/M <= tol)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by