Frage

I've got an problem with fitting of a vector.

I have 2 curves with the same function, which I want to compare. But each curve have a other timevector because they have a different samplingrate (only tstart = 0 and tend = 8.853958 are same).

So I tried to interpolate the short vector to the same length like the long vector... But I dont get it.. In a other simulation it works... But not here...

The error-message is:

Error using chckxy (line 51) The data sites should be distinct.

Error in spline (line 54) [x,y,sizey,endslopes] = chckxy(x,y);

Error in Labor_2ndReceiver (line 434)

dInt = spline(tspline,d,t1);

My code:

tstart = 0;
tstep = 1/fs;
tend = (pi/((1/5)*2))-tstep;
tendSync = 1;                       %Wait for 1 sec

t0 = tstart:tstep:tendSync;         %Time for synchronisation
t01 = tendSync+tstep:tstep:tend;    %Time after synchronisation to Tend
t1 = [t0 t01];                      %Complete Time

dInt = spline(tspline,d,t1);

where

%tspline <1x32605 double>:

%Columns 1 through 24000 all values are '1' 
%and Column 24001 is 0.249041666666667 
%and Column 24002 to 32605 are some increasing values to 8.852958333333334 (but without a constant sampling rate) 

%d <1x32605 double>; t1 <1x424992 double>

So could you help me please? It is very important...

Thank u so much!

EDIT: Thanks, but there is still a problem... see figure...

tspline =0:t1(end)/length(d):t1(end)-t1(end)/length(d);
dInt = spline(tspline,d,t1);

So the Interpolation works... but the Values are wrong... because dInt starts too late.. it shout start like d..

How could I solve this?

http://postimg.org/image/s8hnk1621/

War es hilfreich?

Lösung

You are issuing

dInt = spline(tspline,d,t1);

with

%tspline <1x32605 double>:

% Columns 1 through 24000 all values are '1' 

and there's the problem. You use tspline as the x-locations of your curve, which should all be unique.

Think about it: how would you interpolate a curve through this data set?

enter image description here

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top