Internal Code :1IGCA
Matlab Assignment Help
TASK
The table below shows data for steam at constant pressure:
Temperature C (°C) 100 150 250 300 400
Internal energy E (kJ/Kg) 2507 2584 2634 2810 2968
(a) Determine the internal energy at 220°C using Lagrange or Newton interpolating polynomial of order 1 through 4 (use Lagrange_interp.m or Newton_interp.m). Choose points which should be centered around and as close as possible to the unknown.
(b) Determine the interpolating polynomial curve using all data points (5 points, so polynomial of order 4). And then plot the polynomial with the data in the above table as circles.
(c) Repeat the step (a) using the MATLAB function polyfit.
Let f(x) = cos?(x) , take 6 sample points from f(x)??at x = 0:0.5*pi:pi*2.5, calculate y value for each x. Using x and y data,
(a) construct and plot a free cubic spline with zero second derivatives at two ends using user- defined function cubic_spline_natural;
(b) construct and plot a clamped cubic spline with the real values of the first derivatives at two ends user-defined function cubic_spline_clamped;
(c) construct and plot a not-a-knot cubic spline user-defined codes cubic_spline_notaknot;
(d) Repeat the steps (b) and (c) using MATLAB function spline. Plot your results;
(e) Repeat the step (c) and interpolate a linear spline using MATLAB function interp1. Plot your results.
Given the data below,
x 0.23 0.27 0.35 0.45 0.54 0.67 0.87 0.99
y 0.24 0.22 0.17 0.12 0.09 0.06 0.03 0.02
(a) Using linear_reg1.m, find the least squares curve to fit an exponential function y = abx (You need to transform it to a linear relation first);
(b) Repeat the step (a) using the MATLAB function polyfit.