フィルターのクリア

How to use fprintf for a symbolic matrix

3 ビュー (過去 30 日間)
Jade Henrichon
Jade Henrichon 2021 年 2 月 1 日
回答済み: Star Strider 2021 年 2 月 1 日
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.')

回答 (1 件)

Star Strider
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
.

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by