I have some original data plotted below and I need to interpolate it with my other set of measurements. However whenever I run my interpolation function the initial measurements start at an unreal value. Both sets of data are different lengths.
Original Data
(y is Data, x is just number of measurements)
SS = (:,1:5)
SS1 = SS(:,4) % Time reference
SS2 = SS(:,1) % Data
K = interp1( SS1(1:end,1) , SS2(1:end,1) , RefernceTime(1:end,1),'pchip');
Interpolated data
(y is interpolated data and x is the reference times)

댓글 수: 3

SS = (:,1:5)
is invalid syntax...A variable is missing on RHS, maybe???
SS1 = SS(:,4) % Time reference
SS2 = SS(:,1) % Data
K = interp1( SS1(1:end,1) , SS1(1:end,1) , RefernceTime(1:end,1),'pchip');
Looks like another typo in you've repeated the time() column as both the X and Y values for interp1 arguments.
K = interp1(SS(:,4),SS(:,2), RefernceTime,'pchip');
is probably closer to what you're intending.
Nikolaos Zafirakis
Nikolaos Zafirakis 2019년 7월 24일
편집: Nikolaos Zafirakis 2019년 7월 24일
Hello dpb thanks for spotting that, but this is a dummy copie of my code in the original my code is identical to what you suggested. I am still getting the error and our clueless in how to solve it.
So, SS1 is an array say about 32 columns.
SS2 is an array of equivalent columns.
referancetime is an array of 9 columns.
For some reason I get that massive increase at the beginning.
Bhargavi Maganuru
Bhargavi Maganuru 2019년 8월 20일
Can you attach SS and RefernceTime data files

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

답변 (1개)

Bhargavi Maganuru
Bhargavi Maganuru 2019년 8월 22일

1 개 추천

As you mentioned SS1 and SS2 are arrays of 32 columns, but in the line
K = interp1(SS1(1: end,1), SS2(1: end,1), RefernceTime (1: end,1),'pchip');
it is taking only one column of SS1 and SS2. You can directly use SS1, SS2 and ReferenceTime.
K = interp1(SS1, SS2, RefernceTime, 'pchip');
You can look at following code to interpolate array with 32 columns:
%random data
ss2=rand (1,32);
ss1= (1:32)
ReferenceTime=ss1
k=interp1(ss1, ss2, ReferenceTime, 'pchip')
plot (ss1, ss2,'o', ReferenceTime, k, ':.');
Refer to the following link for more information about “interp1” function:

질문:

2019년 7월 24일

답변:

2019년 8월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by