Basic matrix equation Ax=B with restrictions
6 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
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?
更多回答(2 个)
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
0 个评论
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
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").
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!