EGR 103/Spring 2019/Lab 7

From PrattWiki
Jump to navigation Jump to search

The following document is meant as an outline of what is covered in this assignment.

Typographical Errors

None yet!

Tips

  • There are two edits to the fitting_common code on Python:fitting; one fixes a problem with older Python and clearing figures and the other adds a return to make_plots that is useful for setting labels and saving.
  • After changing the make_plots() command to include the returns, if you need to change axes, add a title, and/or save a plot that was created with the make_plots() command, you can use code similar to:
fig, ax = make_plot(x, y, yhat, xmodel, ymodel)
ax.set_xlabel('x label')
ax.set_ylabel('y label')
ax.set_title('title')
fig.tight_layout()
fig.savefig('filename.etx')

Specific Problems

  • Note in the skeleton that code is already given to bring in the files and figures. If you use different names, just change the names in the skeleton.
  • Be sure to put the appropriate version of the honor code -- if you use the examples from Pundit, the original author is either DukeEgr93 or Michael R. Gustafson II depending on how you want to cite things.

Chapra 14.5

  • See Python:Fitting#Polynomial_Fitting
  • Be sure to also calculate and report \(s_{y/x}\) and \(r\), along with the \(S_t\), \(S_r\), and \(r^2\) values you have to report for every problem.

Chapra 14.7

  • See Python:Fitting#General_Linear_Regression
  • Whenever you have values on an axis that makes the axis numbers take up more space that they should, you can tell Python to use scientific notation on that axis. For this code, you will want to use scientific notation on the y axis; you can do this with the code:
plt.ticklabel_format(axis='y', style='sci', scilimits=(0, 0))
  • Be sure to calculate, report, and discuss the R value. It is not the same as the slope of the line.

Chapra 14.7

Chapra 15.10 and

Chapra 15.10 Alternate

Chapra 15.11

  • See Python:Fitting#Nonlinear_Regression
  • For the initial guesses, make sure you understand the subscripts for the parameters and then figure out how to approximate their values from the information provided in the problem.


General Concepts