# How read Matrix Market data into MATLAB?

조회 수: 9(최근 30일)
Justin Burzachiello 2021년 7월 15일
댓글: Alan Stevens 2021년 7월 16일
Hello. I'd like to read matrix data from the following link: https://morwiki.mpi-magdeburg.mpg.de/morwiki/index.php/Linear_1D_Beam
The link tells me that it is in Matrix Market format, but I am unsure how to extract the M, E, K, B, and C matrices from the attached .m file. Could someone help me extract the data? I'd like to have access to the M, E, K, B, and C matrices the correspond to the following equation:
Here is what the .m file, LF10.m, looks like. There are 18 rows. There is also a .b, .c, .e, and .k file:
• Thank you

댓글을 달려면 로그인하십시오.

### 답변(1개)

Alan Stevens 2021년 7월 15일
Do you mean like this:
%%MatrixMarket matrix coordinate real symmetric
% System: M x_dotdot + E x_dot + K x = B u
% y = C x
%
% Steel beam, 5 nodes
% Properties: Length: 0.1 m, Density: 8000 kg/m^3, Diameter: 1 mm,
% Modulus of elasticity: 2.0e11 Pa, Poisson ratio: 0.29,
% Contr.of M to damping: 1e2, Contr. of K to damping: 1e-2.
% The output node is the node in the middle.
%
Mx = [18 18 50
1 1 8.2666855418381347E-11
2 1 2.3970604543209878E-08
2 2 5.1946160853333332E-05
3 1 -6.1709237860082308E-11
3 3 1.6533371083676269E-10
4 2 8.9335862399999995E-06
4 3 2.3970604543209878E-08
4 4 5.1946160853333332E-05
5 2 -2.3970604543209878E-08
5 3 -6.1709237860082308E-11
5 5 1.6533371083676269E-10
6 4 8.9335862399999995E-06
6 5 2.3970604543209878E-08
6 6 5.1946160853333332E-05
7 4 -2.3970604543209878E-08
7 5 -6.1709237860082308E-11
7 7 1.6533371083676269E-10
8 6 8.9335862399999995E-06
8 7 2.3970604543209878E-08
8 8 5.1946160853333332E-05
9 6 -2.3970604543209878E-08
9 7 -6.1709237860082308E-11
9 9 1.6533371083676269E-10
10 8 8.9335862399999995E-06
10 9 2.3970604543209878E-08
10 10 5.1946160853333332E-05
11 8 -2.3970604543209878E-08
11 9 -6.1709237860082308E-11
11 11 1.6533371083676269E-10
12 10 8.9335862399999995E-06
12 11 2.3970604543209878E-08
12 12 5.1946160853333332E-05
13 10 -2.3970604543209878E-08
13 11 -6.1709237860082308E-11
13 13 1.6533371083676269E-10
14 12 8.9335862399999995E-06
14 13 2.3970604543209878E-08
14 14 5.1946160853333332E-05
15 12 -2.3970604543209878E-08
15 13 -6.1709237860082308E-11
15 15 1.6533371083676269E-10
16 14 8.9335862399999995E-06
16 15 2.3970604543209878E-08
16 16 5.1946160853333332E-05
17 14 -2.3970604543209878E-08
17 15 -6.1709237860082308E-11
17 17 1.6533371083676269E-10
18 16 -2.3970604543209878E-08
18 17 -6.1709237860082308E-11
18 18 8.2666855418381347E-11];
M = zeros(18,18);
for r = 2:51
M(Mx(r,1), Mx(r,2)) = Mx(r,3);
end
disp(M)
1.0e-04 * 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0002 0.5195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0000 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0893 0.0002 0.5195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0002 -0.0000 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0893 0.0002 0.5195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0002 -0.0000 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0893 0.0002 0.5195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0002 -0.0000 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0893 0.0002 0.5195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0002 -0.0000 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0893 0.0002 0.5195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0002 -0.0000 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0893 0.0002 0.5195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0002 -0.0000 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.0893 0.0002 0.5195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0002 -0.0000 0 0.0000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.0002 -0.0000 0.0000
##### 댓글 수: 5표시숨기기 이전 댓글 수: 4
Alan Stevens 2021년 7월 16일
Yes, that's the same matrix I regenerated from your file (the numbers are just displayed slightly differently).

댓글을 달려면 로그인하십시오.

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by