I was checking FIR and IIR filter for offset removal. But I found that FIR can not remove DC offset properly. I think there's something more to do with the filter coefficients of FIR to remove DC offset properly. The Octave code is attached here too. I's almost similar to MATLAB.

clear all;
pkg load signal;
fs = 2000;
ts = 1/fs;
N = 500;
t = [0:N-1]*ts;
cutoff_frequency = 50;
fcl = cutoff_frequency - (cutoff_frequency/2);
fch = cutoff_frequency + (cutoff_frequency/2);
f_test = 50;
f_1 = sin(2pi()f_testt);
f_2 = .3sin(2pi()f_test10t);
Offset = 1.7;
f = Offset + f_1 + f_2;
Wl = 2(fcl/fs);
Wh = 2(fch/fs);
Wm = 2*(cutoff_frequency/fs);
FIR_order = 20;
fc = [0 Wl Wm Wh 1];
m = [0 .03 1 .03 0];
fir_coeff = fir2(FIR_order,fc,m);
filtered_FIR = filter(fir_coeff, 1, f);
IIR_Order = 1;
[b, a] = butter(IIR_Order,[Wl, Wh]);
filtered_IIR = filter(b, a, f);
hold on;
figure 01;
plot(f);
plot(filtered_FIR);
plot(filtered_IIR);
hold off;
fir_coeff, or evenfreqz(fir_coeff), see if that fits a highpass FIR. – a concerned citizen Mar 20 '22 at 10:07