I have a data set like the following:
x= [1, 4, 10]
y= [10, 20, 30]
(x
and y
are value pairs, i.e. (1,10), (4,20), (10,30)
)
I would like to fill the x
values gaps and get linear interpolated values for y
. The linear interpolation should be done between each value pair, i.e. between (1,10)
and (4,20)
and then again between (4,20)
and (10,30)
.
x= [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y= [10,?, ?, 20, ?, ?, ?, ?, ?, 30]
How can I solve this with MATLAB? Regards, Dennis
P.S. My original data set has over 300 value pairs...
Using
interp1
Code:
Results:
Graphical Output using
plot(xi,yi,'-*')