Error in Spline (interpolation)

4 Ansichten (letzte 30 Tage)
Philip
Philip am 10 Feb. 2011
I am using interp1 to do a spline interpolation and I get the below output:
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.270915e-022. > In spline at 91 In interp1 at 279 ...and blah blah blah (more layers)
This is how I called it:
for i = 1:length(fields)
eval(['interpolated.', fields{i},' = interp1(choppedT1,chopped.',fields{i},',choppedMaster, ''spline'');']);
end
"chopped" is a structure of vectrs that have been "chopped" to be the same length. choppedT1 is the timestamp vector for these vectors. choppedMaster is the timestamp vector I am interpolating to. Fields is the array of fieldnames (same for chopped and interpolated). I'm using eval like this because it allows for any fieldname to be used. any ideas?

Antworten (1)

Bruno Luong
Bruno Luong am 10 Feb. 2011
The warning message issued possible due to there are abscissa (chopped filed) too close to each other. You could group them then average to a single data point before interpolation.
Note that structure fields can be accessed using dynamic fieldname, e.g.,
interpolated.(fields{i}) = ...
That syntax allows you to remove all the eye-hurting eval().

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by