Solving Matrices with multiple variables
조회 수: 8 (최근 30일)
이전 댓글 표시

I am really struggling to work out how to solve this, can anyone help with any suggestions of how to solve this for a beginner?
I have tried to search how to solve but all the videos and tutorials I can find are solving simulatneous equations with only variables in one matrix.
I think I mostly need to know how to input variables within the matrices themselves, this should help me with solving the rest.
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 6월 24일
Example:
M = randn(6,6)
guesses = randn(1,6);
f = @(x) [x(1),0,1,2,x(2),x(3)].' - M*[0;x(4);x(5);x(6);0;0]
fsolve(f, guesses)
댓글 수: 2
Walter Roberson
2021년 6월 24일
The general idea is that when you have sets of equations, you can often rewrite them as sets of zero finding.
L1(x) = R1(x)
L2(x) = R2(x)
can be rewritten as
L1(x) - R1(x) = 0
L2(x) - R2(x) = 0
then you drop the = 0 part and build a vector out of the rest,
[L1(x) - R1(x);
L2(x) - R2(x)]
and wrap it in an anonymous function
F = @(x) [L1(x) - R1(x);
L2(x) - R2(x)]
and now you have a function that you can pass to a numeric root-finder such as fsolve .
fsolve() has several algorithms. Estimates of the jacobian might be used to figure out which direction to go in.
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!