How to use fprintf for a symbolic matrix
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Star Strider
2021년 2월 1일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!