Error using interpolation line 64
3 ビュー (過去 30 日間)
古いコメントを表示
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
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
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 :)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Multirate Signal Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!