Solving a vector system
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sorry for asking a foolish question but looking to get some help on a simple problem
Lets say i have a vector A = [6,-8,2] and B = [4,6,12]
I now have two unknown vectors Call them S1 and S4
What i know is that
S1 +S4 = A
And
S1-S4 = B
How do i get matlab to solve this for me?
Thanks
0 Commenti
Risposte (4)
Ceasar_Ullrich9
il 25 Gen 2020
A = [6 -8 2]
B = [ 4 6 12]
MATR = [1 1 ; 1 -1]
MATR^-1 * [A;B]
ans =
5 -1 7
1 -7 -5
basically it's just a linear system where unknowns are vectors instead of scalars
0 Commenti
James Tursa
il 6 Feb 2015
HINT: What do you get when you add the two equations together? And what do you get when you subtract the two equations? Just do that and you can easily solve for what you want and then write the resulting formulas to m-code.
2 Commenti
James Tursa
il 6 Feb 2015
The first part of the HINT was not really about MATLAB, it was about finding algebraic formulas to describe the answer. I will spell out the first one:
S1 + S4 = A
+ S1 - S4 = B
----------------
2*S1 = A + B
From the above you can solve for S1. Then do another calculation by subtracting the two equations instead of adding them. That will help you solve for S4. Then you can code up the expressions you got for S1 and S4 into MATLAB m-code.
Vedere anche
Categorie
Scopri di più su Logical 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!