Using 'single' arrays with the "filter" command

2 visualizzazioni (ultimi 30 giorni)
Jim Clay
Jim Clay il 19 Nov 2012
We have to minimize our application's memory footprint and execution time, so I'm trying to move from "double" data arrays to "single" data arrays. The problem is that the "filter" command appears to return "double" filter states. Is there a way to use "single" data with the filter or even the "conv" command?
  1 Commento
Matt J
Matt J il 19 Nov 2012
Modificato: Matt J il 19 Nov 2012
if your inputs are single, so should the output be.

Accedi per commentare.

Risposte (2)

Jonathan Sullivan
Jonathan Sullivan il 19 Nov 2012
Make sure all your inputs to filter are singles.
Here's an example for a simple moving average:
x = rand(100,1,'single');
a = ones(1,10,'single')/single(10);
b = single(1);
xf = filter(a,b,x);
class(x)
  1 Commento
Jim Clay
Jim Clay il 20 Nov 2012
I have done that, but the second output, the final filter state, is still double.

Accedi per commentare.


Jan
Jan il 20 Nov 2012
Modificato: Jan il 20 Nov 2012
See: FEX: FilterM, which accepts singles also.
Do you mean the 2nd output of filter with "double filter states"?
  1 Commento
Jim Clay
Jim Clay il 20 Nov 2012
Yes, I mean the 2nd output of filter. I will check out the FilterM command.

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by