Skip to content

Instantly share code, notes, and snippets.

@Arunprakash-A
Last active August 27, 2018 17:06
Show Gist options
  • Save Arunprakash-A/5e133beed21800249622aeb02b8ff377 to your computer and use it in GitHub Desktop.
Save Arunprakash-A/5e133beed21800249622aeb02b8ff377 to your computer and use it in GitHub Desktop.

Revisions

  1. Arunprakash-A revised this gist Aug 27, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion FIRFIlterDesign.m
    Original file line number Diff line number Diff line change
    @@ -19,11 +19,11 @@
    [H,W]=freqz(h_n,1);
    % window(:,2)=H;
    subplot(412)
    plot(W,abs(H));
    set(gca,'XTick',0:pi/2:pi)
    set(gca,'XTickLabel',{'0','\pi/2','\pi'})
    xlabel('\omega')
    ylabel('H(e^j^w)')
    plot(W,abs(H));
    title('Using Hanning Window');
    h_n=fir1(n,w,blackman(n+1));
    [H,W]=freqz(h_n,1);
  2. Arunprakash-A created this gist Aug 27, 2018.
    50 changes: 50 additions & 0 deletions FIRFIlterDesign.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    %**********************Designing of LP FIR Filter*************************%
    %************Author : Arun Prakash A *******************************%
    clc;
    close all;
    clear all;
    n=7; % Order of the filter : change it to 71 and see what happens
    w=0.5;
    h_n=fir1(n,w);
    [H,W]=freqz(h_n,1);
    % window(:,1)=H;
    subplot(414)
    plot(W,abs(H));
    set(gca,'XTick',0:pi/2:pi)
    set(gca,'XTickLabel',{'0','\pi/2','\pi'})
    xlabel('\omega')
    ylabel('H(e^j^w)')
    title('Using Hamming Window');
    h_n=fir1(n,w,hann(n+1)');
    [H,W]=freqz(h_n,1);
    % window(:,2)=H;
    subplot(412)
    set(gca,'XTick',0:pi/2:pi)
    set(gca,'XTickLabel',{'0','\pi/2','\pi'})
    xlabel('\omega')
    ylabel('H(e^j^w)')
    plot(W,abs(H));
    title('Using Hanning Window');
    h_n=fir1(n,w,blackman(n+1));
    [H,W]=freqz(h_n,1);
    % window(:,3)=H;
    subplot(413)
    plot(W,abs(H));
    set(gca,'XTick',0:pi/2:pi)
    set(gca,'XTickLabel',{'0','\pi/2','\pi'})
    xlabel('\omega')
    ylabel('H(e^j^w)')
    title('Using BlackMan Window');
    h_n=fir1(n,w,ones(1,n+1)');
    [H,W]=freqz(h_n,1);
    % window(:,4)=H;
    subplot(411)
    plot(W,abs(H));
    set(gca,'XTick',0:pi/2:pi)
    set(gca,'XTickLabel',{'0','\pi/2','\pi'})
    xlabel('\omega')
    ylabel('H(e^j^w)')
    title('Using Rectangular Window');
    % figure
    % plot(W,abs(window))
    % legend('Hamming','Hanning','Blackman','Rectangular')