Error using interpolation line 64

조회 수: 4 (최근 30일)
Andrew Wiebe
Andrew Wiebe 2015년 10월 16일
답변: Mark O'Sullivan 2016년 12월 9일
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
the cyclist
the cyclist 2015년 10월 16일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Mark O'Sullivan
Mark O'Sullivan 2016년 12월 9일
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 :)

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by