"mfilt.firsrc will be removed in a future release"
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm using the "hm.persistentmemory" aspect of this filter, after defining hm = mfilt.firsrc(1,2). I continue to get the warning "mfilt.firsrc will be removed in a future release. Use dsp.FIRRateConverter instead.", but this dsp object doesn't have the persistent memory feature that I need. How do I implement a sample rate converter with persistent memory in the new recommended function?
0 Kommentare
Akzeptierte Antwort
Honglei Chen
am 29 Jun. 2017
What PersistentMemory does is to keep the state in the filter so if the data is streamed in, it would filter properly as if the data is fed in all at once.
On the other hand, for dsp.FIRRateConverter, the state is always remembered, so you don't really need that flag any more. In the example below I just want to show you that the two can arrive at the same result
f1 = mfilt.firsrc(1,2)
f1.PersistentMemory = true
f2 = dsp.FIRRateConverter
f2.InterpolationFactor = 1;
f2.DecimationFactor = 2
f2.Numerator = f1.Numerator
So here we make sure the two filters are setup the same now we'll filter the same data
x = randn(100,1);
y1 = filter(f1,x);
y2 = f2(x);
isequal(y1,y2)
The results for the first segment of signal are the same
y1 = filter(f1,x);
y2 = f2(x);
isequal(y1,y2)
The results for the second segment of streamed signal are still the same so they work the same way.
HTH
3 Kommentare
Honglei Chen
am 30 Jun. 2017
You should be able to do the same thing with dsp.FIRRateConverter
reset(f2); % Clear filter history.
yloop = zeros(20,5); % Preallocate output array.
xblock = reshape(x,[20 5]);
for i=1:5
yloop(:,i) = f2(xblock(:,i));
end
Essentially it maintains the state from one run to the next, as shown in the example above.
HTH
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!