simplest way to print equations
3 ビュー (過去 30 日間)
古いコメントを表示
given large A,b how to print the equations A(1,1) x_1 +A(1,2) x_2+..=b(1)
and preferably least amount of technicality?
2 件のコメント
Walter Roberson
2015 年 9 月 14 日
print them to what output?
Is x_1 intended to indicate x subscript 1? As in you want literal 'x' and a subscript to appear?
回答 (1 件)
Walter Roberson
2015 年 9 月 18 日
part1 = arrayfun(@(col) strcat( cellstr(num2str(A(:,col))), sprintf(' x_%d', col) ), 1:size(A,2), 'Uniform', 0);
part2 = horzcat(part1{:});
part3 = arrayfun(@(row) strjoin(part2(row,:), ' + '), 1:size(A,1), 'Uniform', 0);
part4 = strcat(part3(:), {' = '}, cellstr(num2str(b(:)) ));
part4 is now a cell array of strings, one per row in A
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!