Solving Complex Matrix Operations

4 Ansichten (letzte 30 Tage)
Missael Hernandez
Missael Hernandez am 4 Mär. 2020
I have tried everything!

Akzeptierte Antwort

Fabio Freschi
Fabio Freschi am 4 Mär. 2020
You can do this in a for loop or using arrayfun
% your A vector
A = rand(1,1001); % dummy vector
% calculation of the matrix B
B = arrayfun(@(a)[cos(-a) sin(-a) 0; -sin(-a) cos(-a) 0; 0 0 1],A,'UniformOutput',false);
Than you can access each matrix using the {} indexing, e.g. the first matrix is
B{1}
etc
  5 Kommentare
Fabio Freschi
Fabio Freschi am 4 Mär. 2020
Add
R = cellfun(@(Rx,Ry,Rz)Rx*Ry*Rz,Rx,Ry,Rz,'UniformOutput',false);
Missael Hernandez
Missael Hernandez am 4 Mär. 2020
what if I want to multiply each individual R by another vector?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Language Fundamentals finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by