how to create matrix from another matrix?
Afficher commentaires plus anciens
I need to use a matrix A to create a matrix B
matrix a
A=[123;456;789]
matrix b
B=[1+2i 2+3i 3+4i;4+5i 5+6i 6+7i;7+8i 8+9i 9+10i]
Réponses (1)
Jos Jordan
le 6 Fév 2021
I'm not sure exactly how you are expecting this to be done, but you could simply just do:
A = [1,2,3;4,5,6;7,8,9];
A_imaginary = [2*i,3*i,4*1;5*i,6*1,7*i;8*i,9*i,10*i];
B = A + A_imaginary;
if that's all you needed to do?
4 commentaires
Jos Jordan
le 6 Fév 2021
Modifié(e) : Jos Jordan
le 6 Fév 2021
(Assuming you meant it as a 3x3 matrix, not a 3x1 vector of
[123;
456;
789];
)
Czarek Czarek
le 6 Fév 2021
Jos Jordan
le 6 Fév 2021
B=-A
in that case?
Czarek Czarek
le 6 Fév 2021
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!