====== Differences ====== This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gibson:teaching:spring-2016:math445:lab9 [2016/03/28 10:26] gibson created |
gibson:teaching:spring-2016:math445:lab9 [2016/03/31 09:39] (current) vining |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Math 445 lab 9: 3d graphics ====== | ====== Math 445 lab 9: 3d graphics ====== | ||
- | Important matlab commands: **linspace, meshgrid, pcolor, surf, contour, surfc, contourf, quiver, mesh, load, subplot, pcolor, shading**. | + | Important matlab commands: |
+ | |||
+ | <code> | ||
+ | linspace | ||
+ | meshgrid | ||
+ | pcolor | ||
+ | surf | ||
+ | surfc | ||
+ | contour | ||
+ | contourf | ||
+ | quiver | ||
+ | plot3 | ||
+ | colorbar | ||
+ | load | ||
+ | subplot | ||
+ | shading | ||
+ | </code> | ||
===== Problem 1: pcolor, meshgrid, shading, subplot ===== | ===== Problem 1: pcolor, meshgrid, shading, subplot ===== | ||
Line 58: | Line 74: | ||
</code> | </code> | ||
- | ===== Problem 5: quiver plot ===== | + | ===== Problem 6: quiver plot ===== |
The function | The function | ||
Line 71: | Line 87: | ||
**(b)** In a gentle rainstorm, water will flow down the mountains in the direction of steepest descent, i.e. along the negative of the gradient of $f$. Find the gradient of $f$ using elementary calculus, then make an $x,y$ plot with both contours of the mountain height $f$ and a quiver plot showing the direction of flow of rainwater. | **(b)** In a gentle rainstorm, water will flow down the mountains in the direction of steepest descent, i.e. along the negative of the gradient of $f$. Find the gradient of $f$ using elementary calculus, then make an $x,y$ plot with both contours of the mountain height $f$ and a quiver plot showing the direction of flow of rainwater. | ||
+ | |||
+ | ===== Problem 7: inviscid fluid flow within a square corner ===== | ||
+ | |||
+ | The inviscid 2d fluid flow within a square corner with solid walls at $x=0$ and $y=0$ and the domain $x \geq 0$ and $y \geq 0$ has velocity components | ||
+ | |||
+ | \begin{eqnarray*} | ||
+ | v_x &= v_0 \, x \\ | ||
+ | v_y &= -v_0 \, y | ||
+ | \end{eqnarray*} | ||
+ | |||
+ | Make a quiver plot of this flow for $0 \leq x \leq 1$ and $0 \leq y \leq 1$, and with $v_0 = 1$. Label the axes and title the plot. | ||
+ | |||
+ | ===== Problem 8: inviscid fluid flow past a semicircular bump ===== | ||
+ | |||
+ | The inviscid 2d fluid flow past a semicircular bump of radius $a$ centered at the origin on a flat wall at $y=0$ has velocity components | ||
+ | |||
+ | \begin{eqnarray*} | ||
+ | v_x &= v_0 \left(1 - a^2 \frac{x^2 - y^2}{(x^2+y^2)^2}\right) \\ | ||
+ | v_y &= -2 a v_0 \frac{xy}{(x^2+y^2)^2} | ||
+ | \end{eqnarray*} | ||
+ | |||
+ | Make a quiver plot of this flow for $a=1$, $v_0=1$, $-3 \leq x \leq 3$ and $0 \leq y \leq 3$, excluding the interior of the bump, where $x^2 + y^2 < a^2$. Draw a blue curve that shows the surface of the semicircular bump. Make the $x$ and $y$ axis have the same scale, label the axes, and title the plot. | ||
===== Bonus ===== | ===== Bonus ===== |