how to create on an efficient way zeros in a symbolic matrix?
31 ビュー (過去 30 日間)
古いコメントを表示
hey,
I want to create a matrix/array A with size(n,2) (for arbitrary n) such that
A(:,1) = zeros(n,1)
A([1:n-1],2) = 0;
A(n,2) = x (with x a symbolic, in matlab written as 'sym x' )
How do I do it on a efficient way?
0 件のコメント
採用された回答
その他の回答 (2 件)
Sulaymon Eshkabilov
2021 年 9 月 30 日
syms x
n=4;
A=sym(zeros(n,2));
% A(:,1) = zeros(n,1); % NOT Necessary
% A([1:n-1],2) = 0; % NOT Necessary
A(n,[1,2]) = x %#OK
2 件のコメント
Sulaymon Eshkabilov
2021 年 9 月 30 日
Yes, you are right. But I put A(n, [1, 2]) =x just as an example.
参考
カテゴリ
Help Center および File Exchange で Numbers and Precision についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!