find the interpolation of two values.
2 views (last 30 days)
Show older comments
solleti prabhakarchary
on 8 Oct 2022
Answered: Image Analyst
on 8 Oct 2022
how to find values for this data in between
6 1.256 1.365 0.358 2.589 2.365 2.365 2.456
8 3.250 3.255 3.62 1.25 1.256 2.321 3.214
i would like to find values for 6.5, 7, 7.5 using matlab. which command need to be used please help me in this code.
0 Comments
Accepted Answer
Image Analyst
on 8 Oct 2022
m = [...
6 1.256 1.365 0.358 2.589 2.365 2.365 2.456
8 3.250 3.255 3.62 1.25 1.256 2.321 3.214];
[rows, columns] = size(m);
m2 = zeros(rows + 3, columns);
for col = 1 : size(m, 2)
m2(:, col) = linspace(m(1, col), m(2, col), 5);
end
m2
0 Comments
More Answers (1)
Ghazwan
on 8 Oct 2022
You need to have X and Y vector arrays. The X values need to incapsulate the requested points. You may use interp1 fucntion. For example:
X=[6 1.256 10 ];
Y=[8 3.250 8.5 ];
Ynew = interp1(X,Y,[6.5, 7, 7.5])
See Also
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!