Search code examples
matlab3darea

MATLAB: Create area at z-axis


In MATLAB, the area-function can be used to created a shaded area from data. For example: area([xmin xmax],[ymin ymax]) This are is drawn at the z-axis z= 0. How can I make a shaded area plot at a certain z-distance (so basically just a slice)?


Solution

  • You can use the patch of fill3 functions:

    http://www.mathworks.com/help/matlab/visualize/introduction-to-patch-objects.html

    Simple example:

    X = [0 1 1 0];
    Y = [0 0 1 1];
    Z = [0.5 0.5 0.5 .5];
    fill3(X,Y,Z,'g')
    

    in which you play with the z coordinate. Is that what you meant?