I'm trying to create a Matrix in Matlab, which is dependent on 2 control variables $i$ and $n$. They are defined like this: $i=1:10$, $n=0:N-1$.
Now I'm trying to define a matrix, where an entry is: $cos((i/5)*pi*n)$. With every line $i$ shall increase and with every column $n$.
How can I perform this without using any loops?
Thank you very much
There are may ways, but the easiest is to take the outer product of the vectors:
Other possibilities include using
meshgrid()andrepmat().