How to implement modulo to the code
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
SugerCodeCude
el 4 de Jul. de 2019
Comentada: SugerCodeCude
el 5 de Jul. de 2019
for i = 1:N
if (TFx(i) == 0) && (TFy(i) == 0)
if (sOnAngleH0(i)>=xBotEdge && sOnAngleH0(i)<=xTopEdge...
&& AngleHa(i)>=yBotEdge && AngleHa(i)<=yTopEdge)
xi = ceil((sOnAngleH0(i)-xBotEdge)/[(xTopEdge - xBotEdge)/row]);
yj = ceil((AngleHa(i)-yBotEdge)/[(yTopEdge - yBotEdge)/col]);
%%Would the mod go here and if yes how to set up mod()
bins0to120(xi, yj) = bins0to120(xi, yj) + 1;
end
end
end
The code does the following:
xBotEdge = 0
xTopEdge = 360
yBotEdge = 0
yTopEdge = 360
and row and col are 10.
with Matlab I am having a hard time to implement modulos
To three bins that is:
bin0to120
bin120to240
bin240to360
the data will be in their respectfull bins?
Thank you for any help
4 comentarios
Respuesta aceptada
Guillaume
el 5 de Jul. de 2019
It looks like what you are trying to do is build the histogram of the two variables sOnAngleH0 and AngleHa. This is easily done with histcounts2 and has nothing to do with modulo operations.
binned = histcounts2(SonAngleHo, AngleHa, 0:120:360, 0:120:360)
As Walter said, your bins are not properly defined. The first bin in the above will include 0 but not 120 (which is part of the 2nd bin). The last bin includes both 240 and 360.
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!