Plot square surface in Matlab

后端 未结 3 1114
天涯浪人
天涯浪人 2021-01-21 20:56

How to plot a square surface in Matlab?

More exactly I want to plot a square square with value 0.5 surface which is located at X:-1 to X=1 and Y:2.5 to 3.5.

3条回答
  •  醉话见心
    2021-01-21 21:30

    This is what the patch function is for.

    Matlab documentation

    so for your case:

    X = [ -1  -1   1   1];
    Y = [3.5 2.5 2.5 3.5];
    Z = [0.5 0.5 0.5 0.5];
    
    patch(X,Y,Z,'red')
    view(45,45)
    

    example

提交回复
热议问题