Evaluating symbolic matrix equations
古いコメントを表示
I have a symbolic matrix of size 20x3, which I have created using the sym() function. I have another matrix B which is calculated using certain rows of A, or in general the matrix B is a function of A i.e.,
. Once I obtain all the numerical entries of A, how can I evaluate B after substituting A with the obtained numerical values?
. Once I obtain all the numerical entries of A, how can I evaluate B after substituting A with the obtained numerical values?A = sym('a', [20, 3]); % Create a 20x3 symbolic matrix
% Create a matrix B whose values depend on some function of A's elements
B(1, :) = cross(A(1, :), A(3, :));
B(2, :) = A(5, :) .* A(10, :) .* A(20, :);
% Substitute A with numerical values
A = subs(A, A, rand(20, 3)); % Now, A is a 20x3 matrix with random entries
% How do I evaluate the matrix B?
subs(B) ?
subs(B, A) ? % Both commands aren't working
採用された回答
その他の回答 (1 件)
KSSV
2021 年 7 月 10 日
Read about double.
A = subs(A, A, rand(20, 3));
A = double(A) ;
3 件のコメント
Nishanth Rao
2021 年 7 月 10 日
KSSV
2021 年 7 月 10 日
subs(B) what you want to substitute here? In the above line you have substituted in A. Also the dimensions of A and B are different. How you want to substitute?
Nishanth Rao
2021 年 7 月 10 日
編集済み: Nishanth Rao
2021 年 7 月 10 日
カテゴリ
ヘルプ センター および File Exchange で Common Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


