MATLAB: Define a series of matrices

matrices

How do I define the next series of matrices
A=[0,1;sigma,0].
where
sigma=[-5:0.01:-4]
And I want the label to be as follows
A1=[0,1;sigma(1),0]

Best Answer

Using numbered variables is not going to be neat or efficient. The MATLAB approach would be to use one array, e.g.:
sigma = -5:0.01:-4; % the square brackets are superfluous
N = numel(sigma);
A = [zeros(N,1),ones(N,1),sigma(:),zeros(N,1)]
Each row of A is one of your output vectors, e.g.:
A(1,:)
Related Question