Basic matrix equation Ax=B with restrictions

5 ビュー (過去 30 日間)
LQQD jimenez
LQQD jimenez 2011 年 10 月 8 日
Hi! Im modeling a truss using FEM and im trying to solve a very basic equation A*x=b where a is the stiffness matrix , x and b are the displacements and forces vectors. So A and b are known and i want to find x, the displacements. I know i could type x=b/A in matlab, the thing is i know some of the entries of the x vector due to boundary conditions, and typing a=b/A it works as if all x entries where unknowns. Is there a function to do this in MATLAB ?
Thanks a lot!!
Pd: Sorry for my poor english!

採用された回答

Greg Heath
Greg Heath 2011 年 10 月 9 日
x = [ x1 ; x2 ]% x2 known
A = [ A1 A2 ]% A1 & A2 known
A*x = A1*x1 + A2*x2 % last term known
A1*x1 = b - A2*x2
Voila!
Hope this helps.
Greg
P.S. Ain't Linear Systems grand?
  1 件のコメント
bym
bym 2011 年 10 月 9 日
+1 Much better answer than my feeble attempt

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

その他の回答 (2 件)

bym
bym 2011 年 10 月 9 日
you need to reduce the size of your stiffness and force matrix to eliminate those entries where you know the value of x. I call these Ared and bred. Then perform
xred = Ared\bred
then substitute the known values of x into xred and multiply by the stiffness matrix to get the full force matrix.
It is difficult to explain in words, if you can post your A b x then an example would be better

Dr. Seis
Dr. Seis 2011 年 10 月 9 日
If "x" and "b" are column vectors, then your system of equations is like:
A(1,1) * x(1,1) + A(1,2) * x(2,1) + ... + A(1,N) * x(N,1) = b(1,1)
A(2,1) * x(1,1) + A(2,2) * x(2,1) + ... + A(2,N) * x(N,1) = b(2,1)
...
A(M,1) * x(1,1) + A(M,2) * x(2,1) + ... + A(M,N) * x(N,1) = b(M,1)
If you already know some values of x, then move them to the right-hand side of your system of linear equations. For example, if you know the value of x(2,1) then your system of linear equations would be:
A(1,1) * x(1,1) + A(1,3) * x(3,1) + ... + A(1,N) * x(N,1) = b(1,1) - A(1,2) * x(2,1)
A(2,1) * x(1,1) + A(2,3) * x(3,1) + ... + A(2,N) * x(N,1) = b(2,1) - A(2,2) * x(2,1)
...
A(M,1) * x(1,1) + A(M,3) * x(3,1) + ... + A(M,N) * x(N,1) = b(M,1) - A(M,2) * x(2,1)
In this example (and if x(2,1) = 5), you would then redefine you matrices as follows:
b = b - A(:,2)*5;
A = A(:,1:N~=2);
You will find your new "x" as follows:
x = A\b;
  3 件のコメント
Dr. Seis
Dr. Seis 2011 年 10 月 9 日
The results *should* be identical in theory. However, in practice, using the x=A\b will offer more accuracy (as documented in the Help Navigation under "inv").
Dr. Seis
Dr. Seis 2011 年 10 月 9 日
Updated x = A\b;
from x = inv(transpose(A)*A)*transpose(A)*b;

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

カテゴリ

Help Center および File ExchangeLinear Least Squares についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by