Problem using interp1 with a sharp change in the data

조회 수: 8(최근 30일)
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis 2019년 11월 18일
댓글: Jaime De La Mota Sanchis 2019년 11월 18일
Hello everyone.
I have a vector of data and I want to interpolate it using interp1. The problem is that there is a sharp increase in the values of the vector and the resulting graph does not reproduce the data propperly.
Is there a way to make the interpolated data reproduce the sharp jump propperly?
I will attach a figure where my issue is displayed.
Any answer is appreciated.
Thank you very much.
  댓글 수: 5
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis 2019년 11월 18일
The code I use is simply
being T a vector which values can be seen in the attached T.txt; the same thing happens with time.
What I do next is plot together T-time and Tinterp and t as
plot(t, Tinterp)
hold on
plot(time, T)
title('T Spline')
I hope this clarifies what I am attempting to do.

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


Steven Lord
Steven Lord 2019년 11월 18일
Try using ischange to detect these sharp changes in your data and interpolating using only data in the same "piece" of your curve (where pieces are delimited by the ends of your data sets and the change points) as the points for which you want the interpolated value.



Community Treasure Hunt

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

Start Hunting!

Translated by