calculate weight of each 2D data point
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
a data set consists of x and y, if I want to find out the associated weights for each point. What can I do?
0 comentarios
Respuesta aceptada
Walter Roberson
el 10 de Mzo. de 2011
Please expand on your question.
Are you trying to find out how many of the points fall in to each square of a grid? If so, then you can use accumarray for that:
xgrid = 1 + floor(Nx * (x - min(x)) ./ (max(x) - min(x)));
ygrid = 1 + floor(Ny * (y - min(y)) ./ (max(y) - min(y)));
weights = accumarray([xgrid(:), ygrid(:)], 1);
This will produce an Nx by Ny grid of counts.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Modify Image Colors 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!