Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

4) Plot the surfaces defined by the cone (8-z)2 = x2 +y2and the plane

z=0.1x+0.3y+4 and show their intersection.

//Name:
//Branch:
//Roll No.:
//Intersection of a conical surface and a plane to form an ellipse
//plot the conical surface
deff('z=f1(x,y)','z=8-sqrt(x^2+y^2)') //define the function z=f1(x,y) as a conical surface
x=[-6:0.1:6];y=x ; //populate the vectors x and y
z=feval(x,y,f1); //evaluate matrix z as per f1(x,y) for every value of x & y
surf(x,y,z','edgecolor',[1 0 1],'facecolor',[1 0 1]); //plot z as a surface to show the
//conical surface
//plot the plane
deff('z=f2(x,y)','z=.1*x+.3*y+4') //define the function z=f2(x,y) as a plane surface
x=[-6:0.1:6];y=x ; //populate the vectors x and y
e=gce() //get the handle of graphics
e.color_mode =16; //set the color of the plot
fplot3d(x,y,f2); //plot 3D graph of function z=f2(x,y) to show the plane surface
5) Plot the surfaces defined by the cone (8-z)2 = x2 +y2and the plane
z=0.5(x+y) and show their intersection.

//Name:
//Branch:
//Roll No.:
//Intersection of a conical surface with a plane to form a hyperbola
//Plotting of cone
deff('z=f1(x,y)','z=8-sqrt(x^2+y^2)') // define the function z=f1(x,y) as a conical surface
x=[-6:0.1:6];y=x ; //populate the vectors x and y
z=feval(x,y,f1); //evaluate matrix z as per f1(x,y) for every value of x & y
surf(x,y,z','edgecolor',[1 0 1],'facecolor',[1 0 1]); //plot z as a surface to show the
//conical surface
//Plotting of plane
deff('z=f2(x,y)','z=.5*(x+y)') // define the function z=f2(x,y) as a plane surface
x=[-6:0.1:6];y=x ; //populate the vectors x and y
e=gce() //get the handle of graphics
e.color_mode =23; //set the color of the plot
fplot3d(x,y,f2); //plot 3D graph of function z=f2(x,y) to show the plane surface
6) Plot the surfaces defined by the cylinder z2 = x2 - 8and the plane
z=0.2(x+y) and show their intersection.

//Name:
//Branch:
//Roll No.:
//program for plotting cylinder
deff('[z]=f1(x,y)','z=sqrt(8-x^2)') // define the function z=f1(x,y) as a cylidrical surface
x= [-2.9:0.05:2.9]; y = x; //populate the vectors x and y
z=feval(x,y,f1); //evaluate matrix z as per f1(x,y) for every value of x & y
surf(x,y,z','edgecolor',[0 0 1],'facecolor',[0 0 1]); //plot z to show the upper half of the
//cylindrical surface
surf(x,y,-z','edgecolor',[0 0 1],'facecolor',[0 0 1]); //plot -z to show the lower half of the
//cylindrical surface
//program for plotting plane
deff('[z]=f2(x,y)','z=(x+y)/5') // define the function z=f2(x,y) as a plane surface
x= [-4:0.05:4]; y = x; //populate the vectors x and y
z=feval(x,y,f2); //evaluate matrix z as per f2(x,y) for every value of x & y
surf(x,y,z','edgecolor',[1 0 1],'facecolor',[1 0 1]); //plot z as a surface to show the
//plane surface
7) Plot the surfaces defined by the paraboloid z = 2(x2+y2) and the plane
z=6 and show their intersection.

//Name:
//Branch:
//Roll No.:
//Plotting of paraboloid and sphere
deff('z=f1(x,y)','z=(x^2+y^2)/.5') // define the function z=f1(x,y) as a parabolic surface
deff('z=f2(x,y)','z=6') // define the function z=f2(x,y) as a plane surface
x=-2:0.05:2 ;y=x ; //populate the vectors x and y
fplot3d(x,y,f1) //plot 3D graph of function z=f1(x,y) to show the parabolic surface
e=gce() //get the handle of graphics
e.color_mode =23; //set the color of the plot
fplot3d(x,y,f2) //plot 3D graph of function z=f2(x,y) to show the plane surface
8) Plot the surfaces defined by z = 4sinx and z=5cosx and show their
intersection.

//Name:
//Branch:
//Roll No.:
deff('z=f1(x,y)','z=4*sin(x)') // define the function z=f1(x,y) as a sinusoidal surface
deff('z=f2(x,y)','z=5*cos(x)') // define the function z=f2(x,y) as a cosinusoidal surface
x=0:0.1:3.5 ;y=x ; //populate the vectors x and y
fplot3d(x,y,f1) //plot 3D graph of function z=f1(x,y) to show the sinusoidal surface
e=gce() //get the handle of graphics
e.color_mode =23; //set the color of the plot
fplot3d(x,y,f2) //plot 3D graph of function z=f2(x,y) to show the cosinusoidal surface

You might also like