I'm trying to calculate the following using vectors:
The goal is to have a vector that looks as follows:
\begin{align} y &= \begin{bmatrix} 10^1 \\ 10^2 \\ \vdots \\ 10^k \end{bmatrix} \end{align}
Where k=50.
I'm quite new to MATLAB so I thought about doing the following: \begin{align} k &= \begin{bmatrix} 1 & 2 & \dots & k \end{bmatrix} \end{align}
\begin{align} n &= \begin{bmatrix} 10 \\ 10 \\ \vdots \\ 10 \end{bmatrix} \end{align}
The MATLAB code to compute the answer would then be:
n = ones(20, 1)*10
k = 1:20
y = n.^k
But that code doesn't seem to perform element-wise power as I expected. If anyone has any suggestions as to how I could go about doing this without having to use any for loops that would be much appreciated.
Hope to help you