Interpolate the following data into a smooth curve in the interval ∈ [−2 4.9]. Plot the actual data and the interpolated curve on the same figure.
x| -2 -1.7 -1.4 -1.1 -0.8 -0.5 -0.2 0.1 0.4 0.7 1 1.3
y| 0.1029 0.1174 0.1316 0.1448 0.1566 0.1662 0.1733 0.1775 0.1785 0.1764 0.1711 0.1630
x| 1.6 1.9 2.2 2.5 2.8 3.1 3.4 3.7 4 4.3 4.6 4.9
y| 0.1526 0.1402 0.1266 0.1122 0.0977 0.0835 0.0702 0.0579 0.0469 0.0373 0.0291 0.0224
My current code is...but I'm having trouble doing the actual interpolated curve,would it help putting this data into an excel sheet? First time dealing with this.
close all
clear all
clc
x = [-2, -1.7, -1.4, -1.1, -0.8, -0.5, -0.2, 0.1, 0.4, 0.7, 1, 1.3, 1.6, 1.9, 2.2, 2.5, 2.8, 3.1, 3.4, 3.7, 4, 4.3, 4.6, 4.9];
y = [0.1029, 0.1174, 0.1316, 0.1448, 0.1566, 0.1662, 0.1733, 0.1775, 0.1785, 0.1764, 0.1711, 0.1630, 0.1526, 0.1402, 0.1266, 0.1122, 0.0977, 0.0835, 0.0702, 0.0579, 0.0469, 0.0373, 0.0291, 0.0224];
plot(x,y)