简体   繁体   中英

MATLAB Creating a 2 by 2 matrix from four lists?

I want to construct a time-dependent matrix A

Given

%t = [1,2,3];
A11 = [1,2,3]; %This is time-dependence of A(1,1)
A12 = [2,3,4]; %This is time-dependence of A(1,2)
A21 = [1,1,1]; %This is time-dependence of A(2,1)
A22 = [2,2,2]; %This is time-dependence of A(2,2)

such that

at t = 1 , A = [1 2;1 2];

at t = 2 A = [2 3;1 2];

at t = 3 A = [3 4;1 2];

In general the four lists are much longer. How can I construct a list of matrix A like that so that I know what A is at each timestep for eigenvalues calculation.

After I do that, I want to find the eigenvectors at each timestep. For example,

[VD] = eig(A)

Sounds like you just want a 3D matrix, try

A = cat(3, [1, 2; 1, 2], [2, 3; 1, 2], [3, 4; 1, 2])

Or if you need to build it out of your A11 , A12 , etc... lists then how about

permute(cat(3, [A11;A21], [A12;A22]), [1,3,2])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM