Let's suppose I have a vector x
and 2 constants initialized as follows:
x = [ones(1,21) zeros(1,79)]; %step of 100 components
p = 2; q = 0;
Now, I want to build this matrix:
But in this case for example x(q-1) = x(-1) doesn't exist, so I want it to be 0, and I was wondering if there is a way to do it with the minimum lines of code. Note that the matrix can be written with the function toeplitz()
, but I don't know how to replace nonexistent position of my vector x
with zeros.
I hope someone can help me. Thank you for your answers.
x(q) = x(0)
considered the first element of the vectorx
(Matlab's indexing starts at 1)? Also, the result should be a 100 x 100 matrix(?), and all negative indices should be neglected and the value considered as zero? – HansHirse