assigning multiple values to symbolic variables from a matrix product
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Ashish Gudla
le 5 Août 2014
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 commentaires
Voir également
Catégories
En savoir plus sur Number Theory dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!