When we want to filter a signal in MATLAB using an IIR filter, we can simply pass the IIR filter structure into the filter command, along with our signal, to get a filtered signal, as so:
filteredSig = filter(iirFilterStruct, signal);
Let us say we wanted to filter half our signal first, then the other half, in this case we turn the 'persistent memory' flag of the iirFilterStruct on, and can perform the following:
iirFilterStruct.PersistentMemory = 1;
filteredSigFirstHalf = filter(iirFilterStruct, signal(1:Nsignal/2))
filteredSigSecondHalf = filter(iirFilterStruct, signal((Nsignal/2)+1:end)
This will give us the same result.
My question: I want to be able to extract the filter state, at some arbitrary location during the filtering operation. For example, let us say we were filtering the full signal. At location, say, Nsignal/3, I want to save the IIR filter state, and then later on, USE that state.
How can I do that?