Hey there,
I believe you are getting an error since you are trying to horizontally concatenate a square matrix ( zeros(k) will generate a square matrix of size k x k ) with 1. That will give you a dimensionality error, the one which you are getting. In order to solve this problem, try to use the following code.
l = 10; % for example
x=[1 zeros(1, l)]; % [1 0 0 0 ... 0 0 0]
% or
x=[zeros(1, l) 1]; % [0 0 0 ... 0 0 0 1]
I tried both ways, and what I believe you are trying to plot is the impulse response of a digital filter designed using the Z-transform, where the filter coefficients are obtained from the roots of a polynomial. I got better answers using the first method to generate the responses (the link to view the required response has expired).
Over and above this, you need to use the 1-D filter command in the following way:
p = [1 1 1]; % for example
imp=filter(1, p, x);
You may refer to the documentation links for the filter function from here. In case the required response is different, it would help you solve this question further.
All of this used together, your output would look like this:
clear all;
close all;
clc;
w0=pi/4;
N=15;
z=exp(1i*w0);
n=-N:1:N;
z0=0.9*exp(1i*w0);
p = poly([z0,conj(z0)]);
[H,w]=freqz(1,p,1e3);
figure()
plot(w/pi,abs(H))
grid on
l=length(n)-1;
x=[1 zeros(1, l)];
imp=filter(1, p, x);
plot(n,imp)