how to get a mean Z value inside a certain area I set on a plot
    2 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    EcoBase
 el 24 de En. de 2020
  
    
    
    
    
    Comentada: darova
      
      
 el 23 de Feb. de 2020
            I left the same question a long ago, but I haven't solved the problem yet.
I have a plot as below;

I'd like to get a mean value of all Z values in a paricular area I set on the plot, for example, in the white circle in the figure below;

I wish to know how to set a certain area (draw manually?) and get a mean of all Z values in the area.
Can anyone help me out with this? 
I really appreciate your help in advance!
Attached is the original Matlab figure file. 
2 comentarios
  Adam
      
      
 el 30 de En. de 2020
				If you have the image processing toolbox you can draw polygons using
doc Polygon
which also has a function
createMask
which can be used to extract the points inside that polygon, then you can take the mean in the obvious way.
Respuesta aceptada
  darova
      
      
 el 30 de En. de 2020
        Use this
ind = (Y-65).^2 + (X-85).^2 <= 45^2;        % find indices inside a circle
N = sum(ind(:));                            % number of indices
Z1 = Z.*ind;                                % values inside a circle
meanValue = sum(Z1(:))/N;                   
3 comentarios
  darova
      
      
 el 23 de Feb. de 2020
				Indices inside the circle:
ind = (Y-65).^2 + (X-85).^2 <= 45^2;        % find indices inside a circle
To use these indices:
N = sum( Z(ind)>10 );
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


