I am struggling with declaring some more complex matrices in matlab, perhaps you could help me out,
I have an array of $T$ values / lets call it $y = [y_0, \hdots, y_T]$ (its a digital signal representing a sound).
I am using formula:
\begin{equation}
y_t= a_0 + \sum_{i=1}^p (a_i y_{t-i} + \epsilon_t), t \geq p,
\end{equation}
in order to create a synthetic signal based on the one give using only previous $p$ values of $y_t$, where $p$ is significantly smaller than y. What I have to do, is find those $a_0, \vdots, a_p$ parametres in order to use LSE method.
Now here is what I need you guys to help me with:
How do I create a matrix that looks like this:
\begin{equation}
M =
\begin{bmatrix}
1 & 0 & 0 & 0 & 0 & \hdots & 0 \\
1 & y_0 & 0 & 0 & 0 & \hdots & 0 \\
1 & y_1 & y_0 & 0 & 0 & \hdots & 0 \\
1 & y_2 & y_1 & y_0 & 0 & \hdots & 0 \\
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
1 & y_{T-1} & y_{T-2} & \hdots & \hdots & \hdots & y_{T-p} \\
\end{bmatrix}
\in R^{T+1xp+1}
\end{equation}
Thanks for any help
edit: how to format LaTeX here?
You seem to need a matrix that represents a sort of convolution. In Matlab the toeplitz function is relevant here.
See the following example
So your code should look like the follwing