title: Impulse Response in Z - Domain of a Transfer Function in MATLAB
body: <p>I am implementing Z-Domain TF on MATLAB. While plotting the Pole-Zero Plot, I find that it is correct, and I have no problem in that. The problem is when I plot the Impulse response; i.e <code>h(n)</code>; I find that the first delta is always shifted by one, thus all the other deltas are also shifted. Why does the shift happen? Does anybody have any idea about this problem?</p>
  
  <p>I have provided a simple example of many I have already implemented.</p>
  
  <pre><code>close all;clear;clc;
  
  Ts = 0.1;
  
  num = 1; % b
  den = 1; % a
  
  hz = tf(num, den, Ts, 'variable', 'z^-1')
  
  %% Plotting
  figure(1)
  subplot(2,1,1)
  pzplot(hz)
  axis equal
  
  subplot(2,1,2)
  stem(impulse(hz*Ts))
  axis([0 10 0 1.1])
  grid minor
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/SHZ7G.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SHZ7G.png" alt="impulse response"></a></p>