I have written this MATLAB function to plot the impulse response. But it doesn't give me the desired output (impulse function). I am new to MATLAB. Can anyone tell me where i went wrong with the code?
function  = impulse() t=-10:1:10; x=zeros(length(t)); for(i=-10:1:10) if(i==0) x=1; end plot(t,x); xlabel('t'); ylabel('delta(t)'); title('impulse response'); axis([-10,10,-1,2]) end