The following data define the sealevel concentration of diss

The following data define the sea-level concentration of dissolved oxygen for fresh water as a function of temperature: Estimate O(27) using linear interpolation, and cubic splines. Note that the exact result is 7.986 mg/L. Make comments.

Solution

(a)

% Piecewise linear interpolation:

Exact_value = 7.986;

T=[0 8 16 24 32 40];

O=[14.621 11.843 9.870 8.418 7.305 6.413];

%Create points between 0 and 40

xx=linspace (0, 40);

%Use the linear interpolation

yy=interp1(T, O, xx);

%Plot the graph

plot(T, O, ‘O’, xx, yy)

%Find the value at T=27 by linear interpolation

Est_value=interp1(T, O, 27)

%Find the error

error=abs((Exact_value-Est_value)/Exact_val)*100

(b)

% Piecewise linear interpolation:

Exact_value = 7.986;

T=[0 8 16 24 32 40];

O=[14.621 11.843 9.870 8.418 7.305 6.413];

%Create points between 0 and 40

xx=linspace (0, 40);

%Use the cubic spline

yy=spline(T, O, xx);

%Plot the graph

plot(T, O, ‘O’, xx, yy)

%Find the value at T=27 by cubic spline

Est_value=spline(T, O, 27)

%Find the error

error=abs((Exact_value-Est_value)/Exact_val)*100

 The following data define the sea-level concentration of dissolved oxygen for fresh water as a function of temperature: Estimate O(27) using linear interpolati

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site