Search code examples
matlabtime-frequency

Why black surf from this Matlab command?


Code

tfr = abs ( tfr ); [row_size, column_size] = size(tfr);  
tfr = tfr(1:round(row_size/2), 1:row_size);
surf(tfr); view(2); 

I get in R2014b of OSX 10.10.3 Yosemite

enter image description here

but rotating around shows that the cells should not be black

enter image description here

Why is the output black? I wonder if this is a hardware problem or not.


Solution

  • My bet is that trf is a very large matrix. In these cases, the surface has so many edges (coloured black by default) that they completely clutter the image, and you don't see the surface patches

    One solution for that is to remove the edges:

    surf(trf, 'edgecolor', 'none').
    

    Example: with

    trf = rand(500,500);
    

    the following figures respectively show the result of surf(trf) and surf(trf, 'edgecolor', 'none').

    enter image description here enter image description here