This is how my professor is finding the frequency response of an LTI system when given the impulse response. Is this wrong? My DSP professor uses the freqz() function to find and plot the frequency response and I think it's wrong but I want to make sure before I point it out. Take this example:
Given the impulse response of an LTI, derive an expression for the magnitude and phase response and verify using MATLAB.
$$h(n)=2(-1)^{n-8\over 2}\sum_{k=0}^5 \delta(n-2k)$$
This is how I calculated the freq. response:
The impulse response is just the following values:
h = 2[1 0 -1 0 1 0 -1 0 1 0 -1]
The freq. response is the FT of the impulse response:
$$H(e^{j\omega}) = \sum_{n=-\infty}^\infty h(n)e^{-j\omega n}$$
h(n) exists only for $n=[0,10]$ so I change the limits of summation. Also, the series in the impulse response, converges to 6, so I replace it with 6:
$$\sum_{n=0}^{10} 2\times 6\times (-1)^{n-8\over 2}e^{-j\omega n}$$
Let $n'={n-8\over 2}\Rightarrow n=2n'+8$. Absorb the $(-1)^{n'}$ term. Replace these in the summation and update the limits in terms of n':
$$2\times 6 \sum_{n'=-4}^{1} (-1)^{n'} e^{-j\omega (2n'+8)}=12\sum_{n'=-4}^{1} e^{-j8\omega}(-e)^{-j2\omega n'}=12e^{-j8\omega}\sum_{n'=-4}^{1}(-e)^{-j2\omega n'}$$
And after finding the sum of the series, and some simplifications, the expression becomes:
$$H(e^{j\omega})=\frac{12(1-e^{-12\omega j})}{1+e^{-2\omega j}}$$
I derived the expression for phase response and got the following:
$$\angle H(e^{j\omega})=-5\omega +{\pi\over 2}+\left\{
\begin{array}{ll}
      0,   &amp; k{\pi\over 6}\le\omega\le(k+1){\pi\over 6} \\
      \pi, &amp; (k+1){\pi\over 6}&lt;\omega&lt;(k+2){\pi\over 6} \\
\end{array} 
\right.$$ for $k=0,1,2,...$
I plug in some test value for $\omega$ to get the phase.
Then, to find and plot the frequency response, this is what my professor does:
freqz(h,1,w)
where h is the vector of the impulse response, h(n), and w is the vector of freq. (in rad). He says the '1' is added because it's an FIR filter.
Looking at the MATLAB documentation for freqz none of what he said makes sense. The '1' is supposed to be the arguments for the number of points for the transformation, and 'h' is supposed to be the digital filter represented either by the vector coefficients b and a or other methods.
When I run his code, I get the right shape and points where the frequency jumps up by $\pi$ but not the right values. For example, this is what I get with his plot:

Notice the phase at $\pi /6$.
This is what I get by passing the b and a coefficients from the transfer function $H(e^{j\omega })$:

Notice the phase at $\pi /6$. If I plug in $\omega = \pi /6$ in the expression for the phase response, I get that the phase is $\phi = -\pi /3 \Rightarrow -60^{\circ}$
I tried hours and hours to find out what my mistake was and got very frustrated, until I looked at the documentation. I want to bring this up to him because other students in the class are using his method which inherently gives wrong results, and future students will too, but just to make sure before I do that, am I right or am I wrong?
Thank you!
Your professor is right, and you're almost right too. The filter is clearly an FIR filter, but because its frequency response can be expressed as a geometric series, a recursive implementation is possible.
If you write the transfer function as a rational function you get
$$H(z)=2\frac{1-z^{-12}}{1+z^{-2}}\tag{1}$$
which is almost the same as you got, apart from a constant factor.
Note that there is a pole-zero cancellation in $(1)$, so the filter is FIR with impulse response
h = [2  0 -2  0  2  0 -2  0  2  0 -2];
So apart from rounding errors both

b = 2*[1,zeros(1,11),-1];
a = [1,0,1];
[H1,w] = freqz(b,a,1024);

and

[H2,w] = freqz(h,1,1024);

must give the same result, which turns out to be true. On my machine I get

max(abs(H1-H2))
ans =    7.9623e-14

Note that the phase is ambiguous, so the phase values are only identical up to an additive multiple of $2\pi$.