Matrices with unknown elements multiplication
조회 수: 29 (최근 30일)
이전 댓글 표시
Excuse me i have a question
if i have a similar form of L-U decompostion which is LU=A such that L,U and A are all matrices while L and A are known
but unlike the usual case there is some known elements in the U matrix and i want to find the rest of unknowns in it
how do i do that in matlab please
댓글 수: 0
채택된 답변
John D'Errico
2021년 2월 9일
편집: John D'Errico
2021년 2월 9일
Define the eements of the matrices in terms of symbolic unknowns. Then use solve to determine the unknown elements. Note that unless there are EXACTLY n^2 unknown elements remaining between the matrices L and U, your call to solve must fail.
Note: I can probably do this more efficiently, but...
L = tril(sym('L',[3,3]))
U = triu(sym('U',[3,3]))
U = U + diag([1 2 3]) - diag(diag(U))
So I have created unknown matrices L and U. I've arbitrarily set the diagonal elements of U to the numbers 1,2, and 3.
A = magic(3)
Now, can we solve for the remaining unknowns, such that L*U = A?
syms L1_1 L2_1 L3_1 L2_2 L3_2 L3_3 U1_2 U1_3 U2_3
LUparams = solve(L*U == A)
L = subs(L,LUparams)
U = subs(U,LUparams)
Was I successful?
L*U - A
Look at that. I got lucky.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!