CN – Lab6 (Solution)

$ 29.99
Category:

Description

Least squares approximation
1. The following table list the temperatures of a room recorded during the time interval [1 : 00;7 : 00]: Find the best liniar least squares function ’(x) = ax + b that approximates the table, using the normal equations. Use your result to predict the temperature of the room at 8 : 00: Find the minimum value E(a;b); for the obtained a and b: In the same gure, plot the points (Time, Temperature) and the least squares function.
Time 1 : 00 2 : 00 3 : 00 4 : 00 5 : 00 6 : 00 7 : 00
Temperature 13 15 20 14 15 13 10
2. The vapor pressure P of the water (in bars) as a function of temperature T (in C) is:
T (temperature) 0 10 20 30 40 60 80 100
P (pressure) 0:0061 0:0123 0:0234 0:0424 0:0738 0:1992 0:4736 1:0133
a) Obtain two least squares approximations for the given data, using polyfit for 2 di⁄erent degrees of the polynomials. Find their values for T = 45 using polyval. Compute the approximation errors, knowing that the exact value is P(45) = 0:095848:
b) Plot the interpolation points, the least squares approximants and the
interpolation polynomial, in the same gure.
3. Find the least squares polynomial of 4th degree that t the data given by the vectors x = 3 : 0:4 : 3 and y = sin(x): Plot the points and the least squares polynomial in the same gure. (Use polyfit and polyval:)
4. Consider 10 random points in the plane [0;3] [0;5] using Matlab function ginput: Plot the points and the least squares polynomial of 2nd degree that best ts these points.
1
Facultative:
5. Consider 12 random points in the interval [0;10]: Find the discret least squares approximant of n-th degree for the function f(x) = x2 using the least square approximation method with weight function and the basis
1;x;x2;:::;xn: (The least squares approximant is of the form ’(x) = P aigi(x);
i=1
where fgi; i = 1;:::;ng is a basis of the space and the coe¢ cients ai are obtained solving the normal equations: ). Plot the obtained approximant.
2

Reviews

There are no reviews yet.

Be the first to review “CN – Lab6 (Solution)”

Your email address will not be published. Required fields are marked *