How do I plot the upper view of a matrix and represent the intensity color?
Afficher commentaires plus anciens
I'm trying to represent the shadow intensity of clouds on the ground. I developed a midpoints displacement algorithm to generate 3D fractal surfaces. This algorithm returns values of the height H in a matricial form, with a dimension equal to 257 x 2570. So, I'm using the contourf function to plot the intersection between the generated fractal and a horizontal plane. The resulting intersections for different values of the horizontal plane Z are demonstrated in the figure below, representing 5 layers of the same fractal image that I want to render.

Besides, I want to work with values in a range between 0 and 1, so I can use the weigthed arithmetic means to represent the shadow intensity, once clouds are more opaque in its centers and less opaque at their boundaries. In this way, I'm using the code below to write new S matrices that represents each layers. For the sake of brevity, I'm just showing how I'm obtaining the first layer. Other four layers are obtained in a similar manner, but they result in matrices with more 1's than the first one. Calculating the the weigthed arithmetic means between the five matrices, the result is one matrix with values in a range between 0 and 1.
for cc = 1 : ((N+1) * F) % counting columns
for cl = 1 : (N+1) % counting lines
if P(cl,cc) < plane_z1 % if value of P are lower than the value of the plane Z return 1
S1(cl,cc) = 1;
cont_S1 = cont_S1 + 1;
else % if value of P are larger than the value of the plane Z return 0
S1(cl,cc) = 0;
end
end
end
Now, I want to plot this new matrix, that is an average of the five layers I showed, and represent the scale of each pixel. I just want a scale that represents how dark each pixel is. Moreover, I want to represent values equal to 0 with the white color. In this way, I also want to establish an increasingly dark colormap for values larger than 0 and lower than 1, until values equal to 1 are represented with the black color.
The two problems are:
1) How do I plot the upper view of the resulting averaged matrix in a 2D dimension (like the layers I showed above), once I will not use the contourf function anymore?
2) How do I set the colormap I described above?
I appreciate any help!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Image Processing Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



