How to use fprintf for a symbolic matrix
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have this :
syms n2 n1 R d ;
RS = [1, 0; -(n2-n1)/(n2*R), n1/n2];
P1 = [1, d ; 0, 1];
RF = [1, 0; 0, n2/n1];
Lplanoconvexe = RF*P1*RS;
I want to use fprintf to print my matrix 2x2 like a normal matrix and not on a single line like I have with this command : fprintf('%s', Lplanoconvexe.')
0 commentaires
Réponses (1)
Star Strider
le 1 Fév 2021
Try this:
syms n2 n1 R d ;
RS = [1, 0; -(n2-n1)/(n2*R), n1/n2];
P1 = [1, d ; 0, 1];
RF = [1, 0; 0, n2/n1];
Lplanoconvexe = RF*P1*RS;
C = sym2cell(Lplanoconvexe);
fprintf('%30s\t%30s\n', C{:})
producing:
(d*(n1 - n2))/(R*n2) + 1 (n1 - n2)/(R*n1)
(d*n1)/n2 1
.
0 commentaires
Voir également
Catégories
En savoir plus sur Conversion Between Symbolic and Numeric dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!