# Science:Math Exam Resources/Courses/MATH307/December 2010/Question 04 (b)

MATH307 December 2010
Other MATH307 Exams

### Question 04 (b)

In this question we are once again given 4 points (x1, y1), (x2, y2), (x3, y3) and (x4, y4) in the plane. This time we want to find a quadratic function $\displaystyle q(x)=ax^{2}+bx+c$ that comes closest to going through the points by doing a least squares fit.

(b) Suppose the points (xi, yi) have been defined in MATLAB/Octave as

```X1, ..., X4, Y1, ..., Y4.
```

Write down the MATLAB/Octave code that plots these points, then computes q(x), and finally plots q(x).

 Make sure you understand the problem fully: What is the question asking you to do? Are there specific conditions or constraints that you should take note of? How will you know if your answer is correct from your work only? Can you rephrase the question in your own words in a way that makes sense to you? If you are stuck, check the hint below. Consider it for a while. Does it give you a new idea on how to approach the problem? If so, try it!

 Checking a solution serves two purposes: helping you if, after having used the hint, you still are stuck on the problem; or if you have solved the problem and would like to check your work. If you are stuck on a problem: Read the solution slowly and as soon as you feel you could finish the problem on your own, hide it and work on the problem. Come back later to the solution if you are stuck or if you want to check your work. If you want to check your work: Don't only focus on the answer, problems are mostly marked for the work you do, make sure you understand all the steps that were required to complete the problem and see if you made mistakes or forgot some aspects. Your goal is to check that your mental process was correct, not only the result. Math Learning Centre A space to study math together. Free math graduate and undergraduate TA support. Mon - Fri: 11 am - 5 pm, Private tutor We can help to