Effacer les filtres
Effacer les filtres

How can I increase my dataset length by Interpolation?

29 vues (au cours des 30 derniers jours)
Sahil Patel
Sahil Patel le 5 Mai 2020
Commenté : Ameer Hamza le 5 Mai 2020
I want to increase my data set length from say 5571x1 to 5590x1 by interpolating it non linearly since this dataset is experimental and there is no fixed interval.
All i've experimented with is using 'interp' and 'interp1' but no luck so far.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 5 Mai 2020
This is a simple example which interpolates the data using cubic interpolation
x = rand(5571, 1); % your signal
t = linspace(0, 1, numel(x));
n = 5590; % required length
t_ = linspace(0, 1, n);
x_ = interp1(t, x, t_, 'spline').'; % x_ has dimensions of 5590x1
  2 commentaires
Sahil Patel
Sahil Patel le 5 Mai 2020
Thank you! This helped, although 'spline' changed my signal data a bit. Is there a way to interpolate in such a way that existing data isnt changed?
Ameer Hamza
Ameer Hamza le 5 Mai 2020
You can try 'linear', 'pchip', or 'makima' in place of spline and see which fits your requirement.

Connectez-vous pour commenter.

Plus de réponses (0)

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