title: Implementing a notch filter of 50 Hz in MatLab
body: <p>I'm trying to implement a notch filter of 50 Hz in MatLab. Here is the code:</p>
  
  <pre><code>     subplot(2,1,2);
       %Fse = 220;
       time = 0:1/f:sB-1/f;
       x = buf;
       wo = 60 / (1000/2);
       bw = wo / 50;
       [b,a] = iirnotch(wo,bw);
       y = filter(b,a,x);
       ydft = fft(y);
       xdft = fft(x);
       plot(x,y);
  </code></pre>
  
  <p>The value of buf is <code>buf = zeros([fse*sB,numel(name)]);</code> and the sampling frequency is <code>220 Hz</code>
  And I'm not getting expected results. Can you tell me that where am I wrong?<br>
  The current output is like:<br>
  <img src="https://i.stack.imgur.com/UN2Ct.png" alt="img"></p>
  
  <p>Required output is something like this:<br>
  <img src="https://i.stack.imgur.com/rvPgn.png" alt="img1"></p>
  
  <p>I'm talking about 2nd graph. First graph is good. </p>