Borrar filtros
Borrar filtros

Solving a vector system

5 visualizaciones (últimos 30 días)
Robert
Robert el 6 de Feb. de 2015
Respondida: Ceasar_Ullrich9 el 25 de En. de 2020
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

Respuestas (4)

Ceasar_Ullrich9
Ceasar_Ullrich9 el 25 de En. de 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

James Tursa
James Tursa el 6 de Feb. de 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 comentarios
James Tursa
James Tursa el 6 de Feb. de 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.
Robert
Robert el 6 de Feb. de 2015
James, Thank you. I follow what your saying now.
Your going about it with elimination of course which makes perfect sense. I guess I'm trying to hard to understand the matlab part and not thinking outside of matlab
I can solve it now of course just using elimination. Let me ask you this though. Is there a way for matlab to do it for you? Say i come across a matrix that is not so easy and does not eliminate easily. How can i put these values into a matrix of some sort and ask matlab to solve it? Does it have that ability?

Iniciar sesión para comentar.


Robert
Robert el 6 de Feb. de 2015
Editada: Robert el 6 de Feb. de 2015
Im not sure i am following you. I can surly sit here and do it all out with the components. This would yield 6 questions and 6 unknowns.
So how do i get matlab to do it in one swoop for me?

Robert
Robert el 6 de Feb. de 2015
I do understand your desire to help me to learn something instead of just giving me the answer. However could you be more explicit. I have never used matlab before.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by