I am trying to identify the characteristics of an FIR filter in an ideal case as a sanity check. I observe that there is no strange behaviour, but there is an unexplainable issue in the phase plot of the original and identified filters. To make it simple, I've provided the transfer function coefficients below:
a1 = 1; b1 = [-0.0228015616127155 0.445214656159413 0.776226769351428 0.445214656159413 -0.0228015616127155]; b2 = [-0.0228015616127150 0.445214656159413 0.776226769351428 0.445214656159413 -0.0228015616127150]; G1 = filt(b1,a1); G2 = filt(b2,a1); fmin = 1e-1; fmax = 0.5; Bodeoptions = bodeoptions; Bodeoptions.FreqUnits = 'Hz'; Bodeoptions.Xlim = [fmin,fmax]; Bodeoptions.Ylim = {[-100,10],[0,720]}; Bodeoptions.Grid = 'on'; bode(G1,'-b',G2,':g',Bodeoptions) h = findobj(gcf,'type','line'); set(h,'LineWidth',2); wmin = 2*pi*fmin; H1 = freqresp(G1, wmin); H2 = freqresp(G2, wmin); gain1_dB = 20*log10(abs(H1)); gain2_dB = 20*log10(abs(H2)); phase1_deg = angle(H1)*180/pi; phase2_deg = angle(H2)*180/pi; fprintf('\nAt f = %.4f Hz:\n', fmin); fprintf('G1: Gain = %.16f dB, Phase = %.4f degrees\n', gain1_dB, phase1_deg); fprintf('G2: Gain = %.16f dB, Phase = %.4f degrees\n', gain2_dB, phase2_deg); [mag1, phase1, wout] = bode(G1, wmin); [mag2, phase2, ~] = bode(G2, wmin); gain1_dB = 20*log10(squeeze(mag1)); gain2_dB = 20*log10(squeeze(mag2)); phase1_deg = squeeze(phase1); phase2_deg = squeeze(phase2); fprintf('\nFrom bode():\n'); fprintf('G1: Gain = %.16f dB, Phase = %.4f degrees\n', gain1_dB, phase1_deg); fprintf('G2: Gain = %.16f dB, Phase = %.4f degrees\n', gain2_dB, phase2_deg); Output:
At f = 0.1000 Hz: G1: Gain = 3.4199354940498718 dB, Phase = -72.0000 degrees G2: Gain = 3.4199354940498772 dB, Phase = -72.0000 degrees From bode(): G1: Gain = 3.4199354940498852 dB, Phase = 648.0000 degrees G2: Gain = 3.4199354940498634 dB, Phase = 288.0000 degrees The difference between b1 and b2 is only at the level of machine precision, yet I observe 360$^\circ$ phase shift in the phase plot. I understand that a 360$^\circ$ phase shift has no physical significance, but I would like to understand why this happens with the bode function in MATLAB. Also, it would be great if you could tell me how to correct this when plotting?

bodestatement would be helpful, as well as the exact gain and phase of the two systems at the lowest frequency being plotted. $\endgroup$bodefunction is unwrapping the phase, so you don't get hard-to-interpret jumps in phase from $2 \pi - \epsilon$ and $0$, and that you're starting at slightly different phases, leading to your phase difference. $\endgroup$