Formulas to plot Frequency Impulse Response Coefficients I made this question https://dsp.stackexchange.com/questions/19731/newbieplotting-fft-and-impulse-response-coefficients-using-java

I have the IRC: Impulse Response Coefficients:

$h(k), k = 0, 1,.., N-1$

Low Pass: $h_D(k)=\sin(k\omega_c)/{k\pi} , k\neq0; h_D(0)=2f_c$

High Pass: $h_D(k)=-\sin(k\omega_c)/{k\pi}, k\neq0; h_D(0)=1-2f_c$ 

Band Pass: $h_D(k)=(\sin(k\omega_{cH})-\sin(k\omega_{cL}))/{k\pi}, k\neq0; h_D(0)=2(f_{cH}-f_{cL}) $

Band Stop: $h_D(k)=(\sin(k\omega_{cL})-\sin(k\omega_{cH}))/{k\pi}, k\neq0; h_D(0)=1-2(f_{cH}-f_{cL}) $ 

Hamming Window Function:

$w(k)=0.54+0.46\cos( \frac{2\pi k}{N} )$

so we have:
$h(k) = w(k)\times h_D(k)$

obviusly my $h(k)$ can be represented as:

double[] h = new double[N];  //N:odd integer
...
//hD[(N-1)/2] -&gt; center or hD(0)
...
for (int  k = 0; k &lt; N; k ++) {
  h[k] = hD[k]*w[k];
}


I want to get the formula to evaluate the h[k]

In matlab to do this:

[hFlt,fFlt] = freqz(h,1,256);
mLP = 20*log10(abs(hFlt)); 
plot(fFlt,mLP);




I want to obtain hLP and fLP values to plot filters response (without using matlab).

But I don't know the formulas(procedure or algorythm) to plot the frequency response.
Assuming you have a set of (windowed) filter coefficients $h[n]$, $n=0,1,\ldots,N-1$, and you want to evaluate the corresponding frequency response at $ M\ge N$ equidistant normalized frequency points

$$f_k=\frac{k}{2M},\quad k=0,1,\ldots,M-1\tag{1}$$ 

then you need to evaluate the following formula, which is the discrete Fourier transform (DFT):

$$H[k]=\sum_{n=0}^{N-1}h[n]e^{-j\pi nk /M},\quad k=0,1,\ldots, M-1\tag{2}$$

The actual frequencies in Hz are given by $f_k\cdot f_s$, where $f_s$ is the sampling frequency.

Equation (2) is exactly what you get with the Matlab command

[H,w] = freqz(h,1,M)

where $f_k=$ w(k+1)/(2*pi) (because Matlab indices start at $1$, not at $0$).

If you want to evaluate the frequency response at arbitrary, not necessarily equidistant normalized frequencies $f_k$, you need to evaluate

$$H[f_k]=\sum_{n=0}^{N-1}h[n]e^{-j2\pi nf_k},\quad 0\le f_k\le 0.5\tag{3}$$

which for the choice of $f_k$ according to (1) of course reduces to Eq. (2).