Basic matrix equation Ax=B with restrictions
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
0 Kommentare
Akzeptierte Antwort
Greg Heath
am 9 Okt. 2011
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 Kommentar
Weitere Antworten (2)
bym
am 9 Okt. 2011
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
0 Kommentare
Dr. Seis
am 9 Okt. 2011
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 Kommentare
Dr. Seis
am 9 Okt. 2011
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").
Siehe auch
Kategorien
Mehr zu Linear Least Squares finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!