Functions of Several Variables...ans = Sketching functions of two variables A single variable...
Transcript of Functions of Several Variables...ans = Sketching functions of two variables A single variable...
Functions of Several Variables
DefinitionFunctions of several variables take more than one independent variable as input and uniquely map them to adependent variable such as .
syms x y z t u v wf=x^4-2*y^2*x^2+y^4
f =
g=u^2*v+v^3+4*u*v*w
g =
h=x*y+3*z^2*y+t
h =
The value of a multi-variable function
is the value of the function when values are substituted for the
independent variables . For example in the above functions, we have
subs(f,[x y],[1 0])
ans =
subs(g,[u v w],[1 2 3])
ans =
subs(h,[x y z t],[-1 3 0 1])
1
ans =
Sketching functions of two variablesA single variable functions can be visualized by plotting the graph of f in the -plane. For
example, if we substitute and in the above function g, its v-dependence can be plotted as
ezplot(subs(g,[u w],[1 1]))ylabel('g')
Similarly, there are two ways to visualize two-variable functions :
i) the surface in -space, ii) contour curves constant in the -plane asdepicted for the function f.
ezsurf(f)
2
ezcontour(f)
3
Planes and quadratic surfaces
Below, you see a number of well-known surfaces and command lines to plot them in MATLAB. Note thatin all quadratic cases below, the z-axis is the axis of symmetry. As an exercise, you can regenerate theequations and corresponding graphs with either the x-axis or they-axis as the axis of symmetry. You can alsochange the parameters for each type of surface and check the diversity of the shapes produced.
Plane:
The equation of a plane equation is as discussed previously where is the vector
normal to the plane. For example, for , , , , we have
ezsurf(1-3*x-y)
Cylinder:
The cylinder equation is where r is the base radius and the z-axis is axis of symmetry. For the
case of unit radius, we have .
4
cylinder
To find out how to plot more general cylinders, use
help cylinder
cylinder Generate cylinder. [X,Y,Z] = cylinder(R,N) forms the unit cylinder based on the generator curve in the vector R. Vector R contains the radius at equally spaced points along the unit height of the cylinder. The cylinder has N points around the circumference. SURF(X,Y,Z) displays the cylinder. [X,Y,Z] = cylinder(R), and [X,Y,Z] = cylinder default to N = 20 and R = [1 1]. Omitting output arguments causes the cylinder to be displayed with a SURF command and no outputs to be returned. cylinder(AX,...) plots into AX instead of GCA. See also sphere, ellipsoid.
Reference page for cylinder
Elliptic cone:
5
The elliptic cone equation is in general and for a cone with a circular base and vertex
angle, we have .
ezsurf(-sqrt(x^2+y^2));hold onezsurf(sqrt(x^2+y^2));zlim([-5,5]);hold off
Elliptic paraboloid:
The elliptic paraboloid equation is in general and for the specific case of a circular
paraboloid we have .
ezsurf(x^2+y^2)
6
Sphere:
The sphere equation is where r is the sphere radius. For the case of unit radius, we
have .
ezsurf(-sqrt(1-x^2-y^2));hold onezsurf(sqrt(1-x^2-y^2));zlim([-1,1]);hold off;pbaspect([1 1 1])
7
Ellipsoid:
The ellipsoid equation is where are diameters of crosssectional ellipses
in directions, respectively.
ezsurf(-sqrt(1-x^2/4-y^2));pbaspect([2 1 1]);hold onezsurf(sqrt(1-x^2/4-y^2));zlim([-1,1]);hold off
8
Hyperbolic paraboloid:
The hyperbolic paraboloid equation is with two parabolic intersections
in and planes and hyperbolic intersections in planes.
ezsurf(x^2-y^2)
9
Hyperboloid of one sheet:
The equation of hyperboloid of one sheet is with two hyperbolic intersections
in and planes and an elliptic intersection in plane. As the name tells, z can cover all realvalues resulting in a one-sheet surface.
ezsurf(-sqrt(x^2+y^2-1));hold onezsurf(sqrt(x^2+y^2-1));hold off;zlim([-5,5])
10
Hyperboloid of two sheets:
The equation of hyperboloid of two sheets is with two hyperbolic intersections
in and planes and elliptic intersections in planes where or resulting in atwo-sheet surface.
ezsurf(-sqrt(x^2+y^2+1))hold onezsurf(sqrt(x^2+y^2+1))zlim([-5,5])
11
12