Error using interpolation line 64
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How do i get around this error with says: Error using interp (line 64) Length of data sequence must be at least 9. You either need more data or a shorter filter (L). I can't really add more data, that was the whole point of my interpolation. Any help?
1 commentaire
the cyclist
le 16 Oct 2015
You haven't given us much to help you. Can you post a small, self-contained piece of code that will allow us to replicate the error for ourselves.
Réponses (1)
Mark O'Sullivan
le 9 Déc 2016
If you have a look at the interp .m file the first paragraph states this:
function [odata,b] = interp(idata,r,l,cutoff)
%INTERP Resample data at a higher rate using lowpass interpolation.
% Y = INTERP(X,R) resamples the sequence in vector X at R times
% the original sample rate. The resulting resampled vector Y is
% R times longer, LENGTH(Y) = R*LENGTH(X).
%
% A symmetric filter, B, allows the original data to pass through
% unchanged and interpolates between so that the mean square error
% between them and their ideal values is minimized.
% Y = INTERP(X,R,L,CUTOFF) allows specification of arguments
% L and CUTOFF which otherwise default to 4 and .5 respectively.
% 2*L is the number of original sample values used to perform the
% interpolation. Ideally L should be less than or equal to 10.
% The length of B is 2*L*R+1. The signal is assumed to be band
% limited with cutoff frequency 0 < CUTOFF <= 1.0.
% [Y,B] = INTERP(X,R,L,CUTOFF) returns the coefficients of the
% interpolation filter B.
In other words, the filter needs more than 2*L numbers of original sample points in order to perform the interpolation. (by default is 4 so you need 4*2+1 = 9 samples)
To get around this, you can define the value of L when using the function.
i.e.
interpData = interp(originalData, 50, 2)
% This means you require at least 5 original samples
or
interpData = interp(originalData, 50, 1)
% This means you require at least 3 original samples
Hope this helps :)
0 commentaires
Voir également
Catégories
En savoir plus sur Multirate Signal Processing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!