# Linear phase impulse response causes non linear phase frequency response in GNU Octave/ Matlab

Assume linear phase FIR symteric impulse response like [1 2 3 4 5 5 4 3 2 1],shoud resault in a frequency response with linear phase negative sloped phase. but it doesn't:

>>stem(angle(fftshift(fft([1 2 3 4 5 5 4 3 2 1]))))

causes: But this is wrong the plot must follow the red line. Whats wrong with it?

Another example:

stem(angle(fftshift(fft([1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1]))))

Resault:

It seems it's because phase changes too fast and what we see is something like aliazing! but how to decrease phase change rate and how it effects the filter?

## update

Can you see the inconsistency between two freqz and fft:

The phase of fft must be samples of freqz phase but it isn't!

The OP is also asking why the FFT results shown do not appear to be samples of the frequency response returned by freqz as we would otherwise expect. The FFT as shown is extending from $$0$$ to $$2\pi$$ (in normalized radian frequency), or DC to fs in Hz, but freqz as plotted is only extending $$0$$ to $$\pi$$ (DC to fs/2). There is a parameter you can use in freqz to plot the whole spectrum from $$0$$ to $$2\pi$$ instead (look at the help on the function for that). Also be sure to unwrap the phase when comparing since you could see differences in the phase when rolling over past $$\pm \pi$$.