rotating a tensor where the tensor elements are functions of a third index (conceptually)

2 views (last 30 days)
I have a 3x3 tensor "A" where the elements are a functions of wavelength (e.g. 1000 deep). I need to rotate the tensor, R*A*R', then do other operations. Here R is the usual 3x3 rotation matrix. It would be most convenient to have the tensor look like:
A = [ axx(k), 0(k), 0(k);
0(k), ayy(k), 0(k);
0(k), 0(k), azz(k) ];
I can do all this my looping over k and treating each k-layer as a 3x3, but is there a better way?
There are really 2 questions.
1) Is there a more efficient way to load the 3x3xk array from 1D vectors of axx(k), ayy(k), and azz(k), compared to constructing each k-layer one at a time in a for loop?
2) Is there a way to do the rotation of A (the 3x3xk matrix) without doing the rotation one 3x3 layer at a time in a for loop?

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!