Question: MATLAB PROBLEM 3 OF 5 Problem 3 (5 points) : Interpolation Consider a gas in a piston-cylinder device in which the temperature is held constant.
MATLAB
PROBLEM 3 OF 5
Problem 3 (5 points) : Interpolation
Consider a gas in a piston-cylinder device in which the temperature is held constant. As the volume of the device was changed, the pressure was measured. The volume and pressure values are reported in the following table.
| Volume (m3) | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Pressure (kPa) when I = 300K | 2494 | 1247 | 831 | 623 | 499 | 416 |
-
Interpolate the data using a polynomial that goes through all the data points. (Make sure to display the coefficients you get for the interpolating polynomial.)
-
Plot the data points and the interpolating polynomial through all the data points over the range of 1 to 6 for the volume on a single figure. Use red squares to represent the data points and a black dashed line for the polynomial.
-
Plot the spline interpolation through the same data points on the same figure as part b. Use a cyan solid line for the spline.
-
Estimate the pressure when the volume is 2.8 m3 in three ways:
- using your polynomial interpolation through all the data points
- using a linear interpolation (through the two nearest data points)
- using a spline interpolation
Use a disp command to display your results along with text that makes it clear which technique was used to produce each estimate. To receive full credit for part ii, you must use the polyfit command (and may not use interp1).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
