Error in Spline (interpolation)

4 vues (au cours des 30 derniers jours)
Philip
Philip le 10 Fév 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?

Réponses (1)

Bruno Luong
Bruno Luong le 10 Fév 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().

Catégories

En savoir plus sur Interpolation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by