dsp.FIRRateConverter has unexpected results

1 次查看(过去 30 天)
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(:)))

采纳的回答

Andy
Andy 2017-7-5
编辑:Andy 2017-7-6
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 个评论
Honglei Chen
Honglei Chen 2017-7-6
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

请先登录,再进行评论。

更多回答(1 个)

Honglei Chen
Honglei Chen 2017-7-1
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

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by