Interpolate a 1024x116 Matrix to a 1024x1024 Matrix

조회 수: 1 (최근 30일)
Christopher Gordon
Christopher Gordon 2021년 1월 22일
댓글: Walter Roberson 2021년 1월 26일
Hello!
I have an array of 116 curves (columns) with 1024 data points (rows) each. What I would like to do is expand the matrix to include the curves at the intermediate values between the 116 curves. Which interpolation function should I use, interp1() or interp2()?

채택된 답변

Walter Roberson
Walter Roberson 2021년 1월 23일
Assuming the curves are independent of each other, use interp1()
x = 1:116;
c1 = randn(1,116);
c2 = rand(1,116)*5;
y = linspace(-5,5,1024) .';
curves = c2 .* exp(c1.*y - (y-2).^2);
imagesc(x, y, curves)
xq = linspace(1, 116, 1024);
curves2 = interp1(x, curves.', xq) .';
imagesc(xq, y, curves2)
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 1월 26일
You need to rename or delete your C:\Users\CGordon\Desktop\FindPeaksTrials\interp1.m as it is interfering with calling the MATLAB interp1 function.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by