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!