If I have 5 data points (actually, this could be vary huge number):
$a = [1;2;3;4;5]$
To each data point, I can form a matrix $[a(i),2a(i)]$. (actually, I have to find the matrix, this matrix needs some calculation.)
For example, $[a(i)\times 2+3, 3\times a(i)cos \theta]$
Therefore, I can form 5 such matrices with different values.
Now, If I want to form a big matrix:
$A = \begin{bmatrix}1 & 2 \\2 & 4 \\3 &6 \\4&8\\5&10 \end{bmatrix}$.
One way to do it is by for-loop. Is there any compact way to do it? (If number of data points is very large).
I want to use this technique to form the $A$ matrix in the least square problem. And I have 200 measurements.
I don't know if I understood you well, but if you have:
you can create the matrix: $$\mathbf{A}=\begin{bmatrix}x_{1} & y_{1}\\ x_{2} & y_{2}\\ \vdots & \vdots\\ x_{n} & y_{n} \end{bmatrix}$$ just with the code:
I hope it was usefull to you