Exam3_Key

# Exam3_Key - Signature EID PGE 310 FALL 2005 EXAM 3 SOLUTION...

This preview shows pages 1–4. Sign up to view the full content.

Signature ______________________ EID ____________ PGE 310 FALL 2005 EXAM 3 SOLUTION Work all five problems. Review them all before starting work. All questions are self-explanatory. 1) Consider the following commands entered in a Matlab session: >> sw = [ 0.15 0.2 0.25 0.3 0.4 0.5 0.75]'; >> pc = [ 13 6 5 4.5 4 3.7 3.2]'; >> A = [sw.^2 sw ones(size(sw))]; % basis functions for fitting pc to a quadratic function of sw >> c = (A' * A) \ (A' * pc); % coefficients for the quadratic best fit >> pcf = A * c; % values of the best-fit quadratic evaluated at the values of sw used in the fitting >> residual1 = pcf - pc; % measure the difference between the best-fit curve and the original data >> c2 = spline(sw,pc); % get cubic spline data structure that interpolates the sw-pc data >> pc2 = ppval(c2,sw); % evaluate spline interpolant at the values of sw used to create the interpolant >> residual2 = pc2 - pc; % measure difference between interpolant evaluated at the original sw values, and values of pc at those sw values >> plot(sw,pc,’o’) % plot the original data >> hold on >> plot(sw,pcf) % plot the quadratic best fit a. 10 pts Indicate which statement is true: norm(residual1) > norm(residual2) norm(residual1) == norm(residual2) norm(residual1) < norm(residual2) The vector residual2 is zero, to within machine precision, because the spline function yields a set of piecewise polynomials that pass through the data points ( sw , pc ). The curve-fit quadratic function will not pass through the data points, so the elements of residual1 will be nonzero. The norm of residual1 will therefore be greater than the norm of residual2 .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
10 pts Indicate which of the following three plots was produced. The first plot command graphs the ( sw , pc ) data. The 2 nd plot command graphs pcf , the quadratic best fit to the data, on the same axes. The fit is not linear, so it cannot correspond to the plot of a straight line. Unlike the spline interpolant, the best fit curve does not pass through the data. So the resulting graph must be this one.
2) Resistance heating is being applied to vaporize and then remove hydrocarbons from the soil beneath your company’s crude storage tanks. Measurements of temperature T have been made at 17 locations in the soil, yielding a file of 4- tuples ( x , y , z , T ). On theoretical grounds you expect T to depend on the horizontal distance d from the heat source located at ( x H , y H ), where d x , y ( ) = x - x H ( ) 2 + y - y H ( ) 2 a. 20 pts Write a Matlab function that finds the best fit surface to the observations of T . Use the following basis functions in the order given: d, 1 , d 1 , and z. Input to your function must be the vectors x , y , z , and T and the constants x H and y H . Output must be the vector of coefficients for the best fit surface and a vector of the fitted values of T. function [coeffs Tf] = FitT(x, y, z, T, xH, yH)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This test prep was uploaded on 04/06/2008 for the course PGE 310 taught by Professor Klaus during the Spring '06 term at University of Texas.

### Page1 / 7

Exam3_Key - Signature EID PGE 310 FALL 2005 EXAM 3 SOLUTION...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online