Azzera filtri
Azzera filtri

dsp.FIRRateConverter has unexpected results

1 visualizzazione (ultimi 30 giorni)
I am trying to resample a complex signal and the output of the filter is not what I expect. I expect the output of the following example to be a smooth complex sinusoid, but it seems to have misaligned samples.
filt = dsp.FIRRateConverter;
filt.InterpolationFactor = 8;
filt.DecimationFactor = 2;
x = exp(1i * 2 * pi * [1:100] * 1 / 10).';
y = step(filt,x);
figure(1);plot(real(x))
figure(2);plot(real(y(:)))

Risposta accettata

Andy
Andy il 5 Lug 2017
Modificato: Andy il 6 Lug 2017
It works for those particular values, but I need to work with a range of values. Here's a better example of the problem. Notice that the "resample" function works properly, but for my primary application I am required to use the "dsp" object, which has the problem.
filt = dsp.FIRRateConverter;
filt.InterpolationFactor = 8;
filt.DecimationFactor = 5;
x = exp(1i * 2 * pi * [1:100] * 1 / 10).';
y = step(filt,x);
z = resample(x,filt.InterpolationFactor,filt.DecimationFactor);
figure(1);
subplot(3,1,1);plot(real(x))
subplot(3,1,2);plot(real(y(:)))
subplot(3,1,3);plot(real(z))
  1 Commento
Honglei Chen
Honglei Chen il 6 Lug 2017
In this case, the default filter (see documentation) is not suitable since the cutoff is too high and it introduces the aliasing. Change the filter to
filt.Numerator = firpm(70,[0 0.125 0.2 1],[1 1 0 0]);
and you'll see the right result. However, it also has some group delay effect in it.
The resample designs the filter for you and compensate for the group delay, but it does not work if you have streaming data. That's probably the tradeoff.
HTH

Accedi per commentare.

Più risposte (1)

Honglei Chen
Honglei Chen il 1 Lug 2017
Is there any reason your up and down converter factor is 8 and 2 instead of 4 and 1? Based on the documentation at
"You must use upsampling and downsampling factors that are relatively prime, or coprime." Changing it to 4 and 1 seems to give reasonable results
HTH

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by