I want to plot A^x * v
, where A
is a square matrix represent an adjacency matrix in a graph, x
is the number of steps, and v
is the initial vector.
My goal is to plot the first element of each resulting vector; that is, I want A*v[1], A^2*v[1], A^2*v[1]
I tried
x = 1:1:50
y = A^x*v
plot(y(1),x)
But got
Error using ^
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.
I understand the error, but don't understand how else to approach this problem, just going off Matlab's plot examples.
Thanks in advance for the help!
A
is not a square matrix,A^n
is not defined. Thats why the error comes. – Autonomous