Effacer les filtres
Effacer les filtres

dsp.FIRRateConverter has unexpected results

1 vue (au cours des 30 derniers jours)
Andy
Andy le 30 Juin 2017
Commenté : Honglei Chen le 6 Juil 2017
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(:)))

Réponse acceptée

Andy
Andy le 5 Juil 2017
Modifié(e) : Andy le 6 Juil 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 commentaire
Honglei Chen
Honglei Chen le 6 Juil 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

Connectez-vous pour commenter.

Plus de réponses (1)

Honglei Chen
Honglei Chen le 1 Juil 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

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by