Effacer les filtres
Effacer les filtres

Good morning please help me :( badly needed

1 vue (au cours des 30 derniers jours)
Kevin Ryan Maravilla
Kevin Ryan Maravilla le 14 Déc 2017
How can I equate two matrices element by element suppose the other matrix is a variable matrix?
Ex:
A= [ 1,2,3;2,5,6]
B= [ a+b,a^2+b,c+a;a^2,b,c]
Then the output should Evaluate the valuez of a,b and c
I am typing A=B but that doesnt work also if I type
Y=[A==B], the output will just become
"a+b ==1"
and so on
But does not solve the values what should I do.
Thank you

Réponses (2)

Torsten
Torsten le 14 Déc 2017
Symbolically, this is not possible since you have 6 equations in 3 unknowns.
Try the numeric way to get the least-squares solution for overdetermined problems:
x0=[1 2 3];
fun=@(x)[x(1)+x(2)-1,x(1)^2+x(2)-2,x(3)+x(1)-3,x(1)^2-2,x(2)-5,x(3)-6];
xsol=lsqnonlin(fun,x0)
Best wishes
Torsten.

Kevin Ryan Maravilla
Kevin Ryan Maravilla le 14 Déc 2017
Thank you very much.i'm sorry i asked incompletely, But i am referring to the cholesky method in which Symmetric Matrix will be multiplied to the product of a (lower triangular matrix and its transpose, in which a ,b,c,d,e,f are the variables)
Let A be the input symmetric matrix Let X be the product of lower triangular matrix and its . transpose
Suppose A is a 3x3 symmetric matrix : [1,2,3;2,5,6;3,6,1]
Then X is [a^2 ,ab,ac ; ab,b^2 + d^2,bc+de ;ac, bc+de ,c^2 +e^2 +f^2]
How can I compare A and X, element by element so that i will find the values of a,b,c,d,e,f I just cant type A=X it says error and it doesnt compute the values, i need to find the values of the said variables so that the output will show two matrices one is the lower triangular matrix with the values of a,b,c,d,e,f and the other one is its transpose
*we are not allowed to use chol function / built in functions
Thank you very much for your answer..

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by