Solving Matrices with multiple variables
8 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti

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 Commenti
Risposte (1)
Walter Roberson
il 24 Giu 2021
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 Commenti
Walter Roberson
il 24 Giu 2021
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.
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!