Average value of an annulus in a square matrix
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
matnewbie
el 6 de Mayo de 2016
I have a square matrix of values and I need to evaluate the average value of an annulus between coordinates r and r+dr and repeat this step from the center of the circle to its radius R. Finally, I want to plot the radial profile of the N values, where N is the number of annuli.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/163568/image.png)
How could I do this in MATLAB? Thank you in advance.
0 comentarios
Respuesta aceptada
Image Analyst
el 6 de Mayo de 2016
Editada: Image Analyst
el 6 de Mayo de 2016
So then take your ringPixels, which you get from the snippet in the FAQ, and then use mean to get the average value of your matrix within the ring:
meanValue = mean(yourImage(ringPixels))
By the way, I've attached a related thing. The demo computes the average radial profile (from a point you select) in an image and plots it.
1 comentario
Más respuestas (1)
Jos (10584)
el 6 de Mayo de 2016
R = 3 ;
M = magic(2*R+1) ;
dr = 1 ;
[ri,ci] = ndgrid(1:(2*R+1))
D = hypot(ri-R-1,ci-R-1)
for k=dr:dr:R
TF = D > (k-dr) & D <= k
tmp = M(TF)
Result(k) = mean(tmp)
end
0 comentarios
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!