The signal itself (as well as the value of ‘srate’) may be important here. (The factor of 2 is not necessary.)
I have no idea what the problem is, however one possibility is that there could be ‘ringing’ due to transients at one or the other end of the filtered signal. One way to eliminate that is to initially create the signal as:
signal_to_filter = [ones(10,1)*signal(1); signal(:); ones(10,1)*signal(end)];
use filtfilt on ‘signal_to_filter’, then remove the first and last 10 elements from the filtered signal.
The filter appears to be stable with this value of ‘srate’.
[b,a] = ellip(14,5,30,2*(170/srate),'low');
EDIT — (15 Jun 2021 at 14:24)
‘If I reduce the order to 10, then I am not getting NaNs.’
The transfer-function implementation of the filter itself does not appear to be unstable, however using a second-order-section implementation would be worth trying —
[z,p,k] = ellip(14,5,30,2*(170/srate),'low');
The filtfilt call would then be:
lpfSig = filtfilt(sos,g,Sig);