Construct polynomial sample-rate converter (POLYSRC) filter designer
d = fdesign.polysrc(l,m)
d = fdesign.polysrc(l,m,'Fractional Delay','Np',Np)
d = fdesign.polysrc(...,Fs)
d = fdesign.polysrc(l,m) constructs
a polynomial sample-rate converter filter designer D with an interpolation
factor L and a decimation factor M. L defaults to 3. M defaults to
2. L and M can be arbitrary positive numbers.
d = fdesign.polysrc(l,m,'Fractional Delay','Np',Np) initializes
the filter designer specification with Np and sets the polynomial
order to the value Np. If omitted Np defaults to 3.
d = fdesign.polysrc(...,Fs) specifies
the sampling frequency (in Hz).
Design a Sample-Rate Converter
This example shows how to design sample-rate converter that uses a third order Lagrange interpolation filter to convert from 44.1kHz to 48kHz.
FsIn = 44.1e3; FsOut = 48e3; [L,M] = rat(FsOut/FsIn); f = fdesign.polysrc(L,M,'Fractional Delay',Np=3); FRCObj = design(f,'lagrange',SystemObject=true);
9408 samples of data is 0.2133 seconds long.
n = (0:9407)';
Input signal is a sinusoid at 1 kHz.
F0 = 1e3; x = sin(2*pi*F0/FsIn*n);
The output has 10241 samples (still 0.2133 seconds long).
y = FRCObj(x);
Plot one cycle of the input signal, sampled at 44.1kHz.
stem(n/FsIn, x); hold on; xlim([0, 1/F0]) xlabel('Time (sec)'); ylabel('Signal value')
Plot fractionally interpolated signal (48kHz) in red.
D = outputDelay(FRCObj,Fc=0,FsIn=FsIn); k = (0:length(y)-1); stem(k/FsOut-D, y,'r','filled'); hold off; legend('44.1 kHz sample rate','48 kHz sample rate')
Introduced in R2011a