How to solve a system of linear equations in a matrix (KX=W) where all values of W are known and some value's of X are known?

조회 수: 3 (최근 30일)
A = 8x8 matrix with all values known
X = 8x1 matrix with 3 values known
W = 8x1 matrix with all values known
I've seen some similar posts but I'm still a beginner with matlab so im having trouble understanding them.
num_elem=3
E=70
I=2340*10^6
for i=1:num_elem
if i==1
L=5
elseif i==2
L=5
elseif i==3
L=4
end
k{i}=[12, 3*L, -12, 3*L;
3*L, L^2, -3*L, L^2/2;
-12, -3*L, 12, -3*L;
3*L, L^2/2, -3*L, L^2;]*(E*I/L^3);
sprintf('This is matrix k%d.', i)
k{i}
end
matn=8;
matm=8;
K=zeros(matm,matn);
for n=1:num_elem
for a=1:4
for b=1:4
K(a+((n-1)*2),b+((n-1)*2))=K(a+((n-1)*2),b+((n-1)*2))+k{n}(a,b);
end
end
end
K
W=[0;0;-180000;0;-30000;-5000000;-30000;-5000000]
X=[0;r1;v2;r2;0;r3;v4;r4]

답변 (1개)

Shashank Gupta
Shashank Gupta 2021년 1월 7일
Hi Carmelo,
There are many ways to attack this problem. Simplest way is to just ignore the known variables and solve the equation by considering all the variable in X as unknown. So the X will simply be
X = inv(A)*W;
and then check the known variable in X satisy this equation. if they do well and good. if they don't then there is some mistake you did while forming the equations. Because the following equation must satisfy in the way you formed it.
I hope this helps you.
Cheers

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by