フィルターのクリア

Solving a vector system

5 ビュー (過去 30 日間)
Robert
Robert 2015 年 2 月 6 日
回答済み: Ceasar_Ullrich9 2020 年 1 月 25 日
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

回答 (4 件)

Ceasar_Ullrich9
Ceasar_Ullrich9 2020 年 1 月 25 日
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 2015 年 2 月 6 日
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 件のコメント
James Tursa
James Tursa 2015 年 2 月 6 日
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 2015 年 2 月 6 日
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?

サインインしてコメントする。


Robert
Robert 2015 年 2 月 6 日
編集済み: Robert 2015 年 2 月 6 日
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 2015 年 2 月 6 日
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.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by