필터 지우기
필터 지우기

Interp1 introduces spikes

조회 수: 4 (최근 30일)
Michael Lherbette
Michael Lherbette 2016년 3월 2일
편집: Muhammad Usman Saleem 2016년 3월 3일
Hello,
I would like to interpolate a set of data I have. It represents the indentation vs force of AFM measurement. My vector indentation is not sorted and might have some non unique values.
Here is the code I am using:
[I,ia,~] = unique(Ii,'stable'); % Ii is the initial indentation vector
F = Ff(ia); % Ff is the force I am measuring
Force = interp1(I,F,I(1):0.1e-9:I(end),'pchip');
IndentationCell{i} = I(1):0.1e-9:I(end);
ForceCell{i} = detrend(Force);
However I am getting some spikes as shown in the picture (left side is plot(I,F), right side is plot(IndentationCell,ForceCell) - after interpolation)
Do you have any ideas to overcome this issue ? I already tried changing interpolation method.
Michael
  댓글 수: 1
Adam
Adam 2016년 3월 2일
You would probably have to do a piece-wise interpolation. The problem is that your curve goes back on itself rather than progressing monotonically along the x axis. It is in these places that it introduces the spikes.
If you break your curve up into segments each of which is monotonic along x and interpolate each of those and stitch them back together it should work better I think.
How to break up your curve in such a way is something you would need to think about though. It should be easy enough to locate the points at which the x-values change direction I would think, but is beyond the time I have available to suggest in more detail.

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

답변 (1개)

Muhammad Usman Saleem
Muhammad Usman Saleem 2016년 3월 2일
  댓글 수: 2
Michael Lherbette
Michael Lherbette 2016년 3월 2일
I am sorry but I don't see how this is the solution of my problem
Muhammad Usman Saleem
Muhammad Usman Saleem 2016년 3월 3일
편집: Muhammad Usman Saleem 2016년 3월 3일
interpolate1 interpolate data which is in 1 dimension. Some times its start to interpolate values based on next values. Please consider your data set stickily in 1 dimension. @Adam anwser is also right

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

카테고리

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