Interpolation of unequally spaced data

조회 수: 23 (최근 30일)
dEEPAK MAT
dEEPAK MAT 2014년 7월 15일
댓글: Image Analyst 2014년 7월 15일
I have a small set of (x,y) data points which are not evenly spaced. I want to interpolate the data for some analysis work.With very few points I am unable to work out.I cant use interp1 for the data is not evenly spaced.ANY SUGGESTIONS ?
3425.0 12.5 825.0 25 200 37.5 75 50 25 62.5 12.5 75
  댓글 수: 2
Image Analyst
Image Analyst 2014년 7월 15일
Please supply the x locations, and the y values of your input data. Then supply us the x locations of the places where you want your estimated output y values.
John D'Errico
John D'Errico 2014년 7월 15일
It is simply NOT true that you cannot use interp1. READ THE HELP.

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

채택된 답변

Star Strider
Star Strider 2014년 7월 15일
Your data do not have to be evenly spaced to use interp1.
For example:
x = sort(unique(randi(50,1,10)));
y = randi(10,1,length(x));
xi = linspace(0,max(x),15);
yi = interp1(x,y,xi,'linear');
figure(1)
plot(x,y,'-*b')
hold on
plot(xi,yi,'pr')
hold off
grid
legend('Original','Interpolated')
  댓글 수: 1
Image Analyst
Image Analyst 2014년 7월 15일
It's not clear, but his xi might also be randomly located (that's why I asked), but your code should also work with
xi = sort(unique(randi(50,1,10)));
just as well, since, like John said, there's no reason interp1 won't work with randomly located data.

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

추가 답변 (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