

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for problem set 2 of math 241 (laskowski) fall, 2007. Students are required to use matlab to graph functions, plot level curves, and analyze heat flux. Instructions include creating array-smart functions, using meshgrid and surf, contour plots, and quiver plots.
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


MATH 241 (Laskowski) Fall, 2007 MATLAB Problem Set 2 Due Tuesday, October 23
Note: Matlab online help commands gives examples of meshgrid and surf.
Be sure to make it āarray smartā (or āvectorizedā). i.e., use dots. a) Graph f over the square D = {|x| ⤠2 , |y| ⤠2 }. Hint: Use the meshgrid command to make the set of grid points and then use surf. Label the axes. b) Plot the level curves (contours) of f in the xy plane in the same square D. You can use the command contour (works analogously to surf). Label the axes.
Note: You can put the plots of parts a) and b) together on the same page with the command subplot.
u(x, y) = (ā 4 x^3 + 3x^2 + 1)(y ā y^2 ).
Make sure it is āarray smartā. The function u is the temperature at a point (x, y) in the unit square Q = { 0 ⤠x ⤠1 , 0 ⤠y ⤠1 }. The heat flux at each point is defined to be the negative of the gradient vector āāu(x, y) = ā[ux(x, y), uy(x, y)]. a) Verify by hand that ux(0, y) = 0 for 0 ⤠y ⤠1 and that u = 0 on the other three edges of the square. (*** You do not need to turn this part in.) This means that the left edge of the square is insulated, and that the temperature is held at zero on the other three edges. b) Put a 20 by 20 meshgrid on Q. Graph u over Q using the command surf(X,Y,u(X,Y)). Note where the temperature is greatest, and the appearance of the surface on the edge x = 0. c) Compute the partial derivatives ux and uy. You can either have MATLAB do this, or you can compute the partial derivatives by hand and then enter the functions ux and uy into MATLAB by hand. Then enter the commands
U = u(X,Y); Ux = ux(X,Y); Uy = uy(X,Y); contour(X,Y,U,20) hold on quiver(X,Y,-Ux,-Uy)
Note: The last command attaches arrows at each point of the meshgrid to repre- sent the vector field of the heat flux. d) Use the plot of part c) to answer the following questions.