⇐ back

    Creating 3d surface graph

    to create a 3D surface graph:

    Create input vectors for x and y axis. Then create matrix, which size is consistent with input vectors. For instance, if v1 is a vector for x axis with length M, and v2 is a vector for y axis with length N, then matrix A should have size M x N. Execute:

    v1 = < -5:5 >

    v2 = v1

    A[v1, v2] = (v1^2 + v2^2)/5

    surf(v1, v2, A)

    ex24

    If inputs are named vectors (like in previous example), you can use expression, which is function of these vectors:

    surf(x, y, 3*sin(x*y/2))

    ex25

    to add surface to the previous surface graph use surfAdd command:

    surfAdd(x, y, z2)