Answer to Quiz 10 Fri 13 Apr 2007

  1. A simplex is the three dimensional analogue to a triangle, spanned by four points:
           a = [2 3 -1]; b = [2 4 9]; c = [3 -1 8]; d = [4 3 1];
    
    Start by typing in this line in a MATLAB session. To compute the volume of this simplex, we proceed as follows:
    1. define the matrix whose rows are b - a, c - a and d - a;
    2. compute the absolute value of the determinant of this matrix;
    3. divide this value by six.
    What is the volume of this simplex? Give all relevant MATLAB commands.

    Answer:

        m = [ b - a ; c - a ; d - a ]
        abs(det(m))/6
    
           ans = 16.000
    

  2. Give all MATLAB commands to plot the surface defined by z = x^2 - y^2, for (x,y) in [-2,+2] x [-2,+2]. Describe what does the surface looks like.

    Answer:

        xr = -2:0.01:2;
        yr = -2:0.01:2;
        [x,y] = meshgrid(xr,yr);
        z = x.^2 - y.^2;
        mesh(x,y,z)
    
                  the surface is a saddle