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?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
KSSV
am 4 Jan. 2021
All the unkniowns will be zeroes right? You can give a try with hand calculations.
Antworten (1)
Shashank Gupta
am 7 Jan. 2021
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/480933/image.png)
I hope this helps you.
Cheers
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!