====== Differences ====== This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gibson:teaching:fall-2013:math445:hw4 [2013/11/06 14:18] gibson created |
gibson:teaching:fall-2013:math445:hw4 [2013/11/14 09:43] (current) gibson |
||
---|---|---|---|
Line 10: | Line 10: | ||
* **plotting:** ''plot, semilogy, semilogx, loglog, contour, mesh'' | * **plotting:** ''plot, semilogy, semilogx, loglog, contour, mesh'' | ||
* **loops:** ''for'' and ''while'' | * **loops:** ''for'' and ''while'' | ||
- | * **anonynmous functions:** defining and using | + | * **anonymous functions:** defining and using |
* **solving equations:** with ''fzero'' or ''newtonsearch'' | * **solving equations:** with ''fzero'' or ''newtonsearch'' | ||
+ | \\ | ||
**Problem 1:** Write a Matlab function named ''farenheit2celsius'' that converts | **Problem 1:** Write a Matlab function named ''farenheit2celsius'' that converts | ||
Line 18: | Line 19: | ||
Write the function in a file ''farenheit2celsius.m''. | Write the function in a file ''farenheit2celsius.m''. | ||
+ | \\ | ||
**Problem 2:** Write a for-loop that prints a Farenheit to Celsius conversion table | **Problem 2:** Write a for-loop that prints a Farenheit to Celsius conversion table | ||
Line 32: | Line 34: | ||
six spaces for the floating-point //C// numbers, with 1 digit after the decimal point. | six spaces for the floating-point //C// numbers, with 1 digit after the decimal point. | ||
- | **Problem 3:** Make a plot of C versus F over the range -50 <= F <= 212. Put symbols | + | \\ |
+ | |||
+ | **Problem 3:** Make a plot of C versus F over the range %%-50 <= F <= 212%%. Put symbols | ||
on the line where water freezes and boils: a circle for freezing and a square for | on the line where water freezes and boils: a circle for freezing and a square for | ||
boiling. Label the axes and give the graph an appropriate title. | boiling. Label the axes and give the graph an appropriate title. | ||
+ | \\ | ||
- | **Problem 4:** Use Matlab's **anonymous function** facility to define a | + | **Problem 4:** Use Matlab's anonymous function facility to define a |
- | ''farenheit2celsius'' at the Matlab prompt, instead of writing it in a file | + | ''farenheit2celsius'' function at the Matlab prompt, instead of writing it in a file |
as in problem 1. | as in problem 1. | ||
+ | |||
+ | \\ | ||
**Problem 5:** Use matlab's ''fsolve'' function or your ''newtonsearch'' function | **Problem 5:** Use matlab's ''fsolve'' function or your ''newtonsearch'' function | ||
Line 46: | Line 53: | ||
the equation with algebra. | the equation with algebra. | ||
- | **Problem 6: Verify your answer from problem 5 by evaluating your ''farenheit2celsius'' | + | \\ |
+ | |||
+ | **Problem 6:** Verify your answer from problem 5 by evaluating your ''farenheit2celsius'' | ||
function at the value found as an answer to problem 5. | function at the value found as an answer to problem 5. | ||
+ | \\ | ||
**Problem 7:** Write a script that produces a multiplication table like this | **Problem 7:** Write a script that produces a multiplication table like this | ||
Line 61: | Line 71: | ||
''fprintf'' function with a formatting code like in problem 2 to get uniform spacing. | ''fprintf'' function with a formatting code like in problem 2 to get uniform spacing. | ||
+ | \\ | ||
**Problem 8:** Find a solution to the system of equations | **Problem 8:** Find a solution to the system of equations | ||
Line 73: | Line 84: | ||
using Matlab's ''fsolve'' function or your ''newtonsearch''. | using Matlab's ''fsolve'' function or your ''newtonsearch''. | ||
+ | \\ | ||
**Problem 9:** Deduce the functional relationship ''y(x)'' for the data in this plot. | **Problem 9:** Deduce the functional relationship ''y(x)'' for the data in this plot. | ||
+ | {{:gibson:teaching:fall-2013:math445:prob9.png?nolink&300|}} | ||
+ | |||
+ | \\ | ||
**Problem 10:** Assume you have a file ''data.asc'' containing the data for the above graph, | **Problem 10:** Assume you have a file ''data.asc'' containing the data for the above graph, |