Functions of Several Variables...ans = Sketching functions of two variables A single variable...

12
Functions of Several Variables Definition Functions of several variables take more than one independent variable as input and uniquely map them to a dependent variable such as . syms x y z t u v w f=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

Transcript of Functions of Several Variables...ans = Sketching functions of two variables A single variable...

Page 1: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 2: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 3: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

ezcontour(f)

3

Page 4: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 5: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 6: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 7: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 8: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 9: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 10: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 11: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

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

Page 12: Functions of Several Variables...ans = Sketching functions of two variables A single variable functions can be visualized by plotting the graph of f in the -plane. For example, if

12