

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Instructions. This project is to be done using MATLAB. Use the diary command to save your work. Edit the saved file to include your name, problem numbers, and the answers to any questions asked in the problems. You should also hand in your printed output. Note that you can use the help command to learn about other commands (e.g. help cross).
(1) In this problem we plot and find the Frenet frame of the parametrized space curve r(t) = cos(t)ˆi + sin(t)ˆj + t/ 2 πkˆ. Run the following script. Use the title command to title your graph “Frenet.”
t=linspace(0, 4∗pi, 100); x=@(t) cos(t); y=@(t) sin(t); z=@(t) t/(2∗pi); plot3(x(t),y(t),z(t)) hold on; Now put in the frame: axis equal t=frenet(x,y,z) At this point you will be prompted for values of t. Use the following successively: t = 0,. 8 π, 2. 2 π, 3. 6 π. Then do the command view(135, 40). Print the picture you obtain.
(2) Here we view the graph of a saddle point using the qsurf command. Enter the following:
h=@(x,y) x.∧2-y.∧2; qsurf(h, [-1 1 -1 1], 30) Print the picture you obtain with the title “Saddle point.”
(3) We now compute a Riemann sum.
g=@(x,y) 2- x.∧2-y.∧2; riemann(g, [-1 1 -1 1],1) You will be prompted for the number of subdivisions. Use a 20 × 20 grid. How close (in terms of percent) is the answer to the correct value? Print the picture you get with the title “Riemann.”
(4) Level curves are displayed using the contour command, and vector fields are dis- played using the quiver command.
Date: November 4, 2008.
2
f=@(x,y) x.∗y-(x.∧3)/3; fx=@(x,y) y-x.∧2; fy=@(x,y) x; x=-2:.05:2; y=x; % this is the fine mesh for the level curves [X,Y]=meshgrid(x,y); Z=f(X,Y); % now we choose the level curves levels=[-6:.5:6]; contour(X,Y,Z, levels) hold on xx=-2:.2:2; yy=xx; % this is the fine mesh for the vector field [XX,YY]=meshgrid(xx,yy); U=fx(XX,YY); V=fy(XX,YY); quiver(XX,YY,U,V); axis equal Print the picture you obtain with the title “Gradient” and describe it. In particular, t=frenet(x,y,z) At this point you will be prompted for values of t. Use the following successively: t = 0,. 8 π, 2. 2 π, 3. 6 π. Then do the command view(135, 40). Print the picture you obtain. (2) Here we view the graph of a saddle point using the qsurf command. Enter the following: >> h=@(x,y) x.∧2-y.∧2; >> qsurf(h, [-1 1 -1 1], 30) Print the picture you obtain with the title “Saddle point.” (3) We now compute a Riemann sum. >> g=@(x,y) 2- x.∧2-y.∧2; >> riemann(g, [-1 1 -1 1],1) You will be prompted for the number of subdivisions. Use a 20 × 20 grid. How close (in terms of percent) is the answer to the correct value? Print the picture you get with the title “Riemann.” (4) Level curves are displayed using the contour command, and vector fields are dis- played using the quiver command. Date: November 4, 2008. 2 >> f=@(x,y) x.∗y-(x.∧3)/3; >> fx=@(x,y) y-x.∧2; >> fy=@(x,y) x; >> x=-2:.05:2; y=x; % this is the fine mesh for the level curves >> [X,Y]=meshgrid(x,y); >> Z=f(X,Y); % now we choose the level curves >> levels=[-6:.5:6]; >> contour(X,Y,Z, levels) >> hold on >> xx=-2:.2:2; yy=xx; % this is the fine mesh for the vector field >> [XX,YY]=meshgrid(xx,yy); >> U=fx(XX,YY); V=fy(XX,YY); >> quiver(XX,YY,U,V); >> axis equal Print the picture you obtain with the title “Gradient” and describe it. In particular, what is the relationship between the level curves and the arrows?