0
$\begingroup$

I have frequency response of low pass filter

    M=8  %%%channel 
    x=8*512 
    d1=fir1(N-1,wc/pi,w); 
    % L=length(d1); 
    % for k=1:L 
    %     b2(k)=((-1)^k)*d1(k); 
    % end 
    %%%%%%Frequency response 
    h1=fft(d1,x);
    a1=max(abs(h1)); 
    m1=20*log10(abs(h1/ a1));
    c=0:x-1 
    plot(f1/x,m1)

I have to find magnitude responce at $\omega=\dfrac{\pi}{2M}$ i.e., $h_1$ at $\omega=\dfrac{\pi}{2M}$

$\endgroup$
  • $\begingroup$ So what's your problem with finding the magnitude at $\omega=\pi/2M$? $\endgroup$ – Matt L. Aug 23 '15 at 19:44
1
$\begingroup$

Your code has too many unassigned variables for us to execute it. Your FFT freq axis, in radians/sample, goes from 0 –to- 2pi. The equivalent mathematical FFT integer freq axis index goes from 0 –to- 4095. You want to know h1 at w = pi/(2M) radians/sample. Let's use variable k to represent the mathematical FFT integer index corresponding to your w.

So we can set two ratios equal to each other: k/4096 = w/2pi. Next we write k/4096 = (pi/(2M))/2pi. This gives us k = 4096/(4M) = 4096/32 = 128 as the math index corresponding to your w. Because of Matlab's unpleasant indexing method the magnitude response you want to examine is your h1(k+1) = h1(129) FFT sample. [By the way, as long as your M is an integer power of two, k will be an integer. If M is not an integer power of two, you'll have to use either a 'floor()' or 'ceil()' command to compute the mathematical FFT integer index k.]

$\endgroup$
  • $\begingroup$ if i use freqz instead of fft then what is magnitude responce at ω = π/2M.Code Given is d1=fir1(N-1,wc/pi,w); [h1,fre1]=freqz(d1,1,x) a1=max(abs(h1)); plot(fre1/pi,a1) $\endgroup$ – Rajat Sharma Aug 24 '15 at 19:11
  • $\begingroup$ If you insist on using the freqz() command instead of the fft() command, use the command [h1,fre1]=freqz(d1,1,x, 'whole') to plot the full freq magnitude response of your d1 coefficients. The '2' on the right side of the freq axis is equivalent to 2pi radians/sample (Fs samples/second). $\endgroup$ – Richard Lyons Aug 25 '15 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.