find the interpolation of two values.
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2022-10-8
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 个评论
更多回答(1 个)
Ghazwan
2022-10-8
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])
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!