assigning multiple values to symbolic variables from a matrix product
2 ビュー (過去 30 日間)
古いコメントを表示
I am using Kramer's rule to use a product of matrices to produce 2 values. How do I initialize these 2 values to symbolic variables? For example I've tried
(a,b)=inv(A)*B
where A and B and the matrices. I want a to equal the first solution and b to equal the second solution. A is 2X2, B is 1X2.
Any help is appreciated.
0 件のコメント
回答 (1 件)
Ashish Gudla
2014 年 8 月 5 日
I dont believe there is a way to directly assign a vector to a comma separated list.
If you are just working with 2 variables the easiest way would be
C = inv(A)*B;
a=C(1);
b=C(2);
clear C; % so that you can free up the memory
You can however use comma separated list if you have a cell array.
C = inv(A)*B;
D = num2cell(C);
[a,b] = D{:};
clear C;
clear D;
Hope that helps.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Number Theory についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!