Clear Filters
Clear Filters

By using linear interpolation How can we find unkown 500 data values by using known data points(x,y,z) ?

1 view (last 30 days)
[x1,y1,z1] = [2 3 4]; % starting value
[xn,yn,zn] = [7 2 5]; % ending value
by using linear interpolation i want to generate 500 unkown values inbetween known starting and ending value...
i know the linspace function,,but i want to generate points by using only linear interpolation concept
i need your help
thank you?

Accepted Answer

Ameer Hamza
Ameer Hamza on 2 Sep 2020
If you consider are at [x1,y1,z1] at t=0 and [xn,yn,zn] at t=1, then you can write following line using linear interpolation
X1 = [2 3 4]; % starting value
Xn = [7 2 5]; % ending value
t1 = 0; % start time
tn = 1; % end time
t = linspace(0, 1, 500); % samples between start and end time
X = interp1([t1 tn], [X1; Xn], t);

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!