Comma seperated list from a non rectangular matrix

I have an non rectangular matrix(sort of) that sthe size also changes depednign on a user input.
[ 400, 400, 400]
[2*T22 + T31 + 400, T21 - 4*T22 + T23 + T32 + 400, T22 - (1876*T23)/5 + T33 + 353440]
[T21 + 2*T32 + T41, T52 + T61 - 4*T62 + 5478, 2*T23 + T32 - (1876*T33)/5 + T43 + 352640]
[T31 + 2*T42 + T51, T32 + T41 - 4*T42 + T43 + T52, 2*T33 + T42 - (1876*T43)/5 + T53 + 352640]
[T41 + 2*T52 + T61, 2*T42 + 2*T51 - (1886*T52)/5 + T53 + T62 + 352640, T43 + T52 - (1866*T53)/5 + 352640]
[T51 + 2*T62 + 400, 2*T52 + T61 - (1876*T62)/5 + 353040, 950]
[ 400, 400, 950]
I want to call the symbolics equations from the matrix using a comma seperated list. So I can use equations to matrix(equation). I dont want any of the constants so when I wrote the code for thisI called the top rectangle and the bottom Rectangle. I want to call everything except the 950's this is what I have been trying.
w=2;
e=0.32/Deltaxy+1;
r=1;
t=0.16/Deltaxy+1;
y=0.32/Deltaxy+2;
u=L/Deltaxy;
i=1;
o=0.08/Deltaxy+1;
eqns1 = B(2:e,1:t)
eqns2 = B(y:u,1:t-1)
equation=(eqns1:eqns2)
[X,b] = equationsToMatrix(equation)
Y = inv(X)
T=double(Y*b)
But keep geeting missmatched error.

 Akzeptierte Antwort

format long g
syms T21 T22 T23 T31 T32 T33 T41 T42 T43 T51 T52 T53 T61 T62
B = [
[ 400, 400, 400]
[2*T22 + T31 + 400, T21 - 4*T22 + T23 + T32 + 400, T22 - (1876*T23)/5 + T33 + 353440]
[T21 + 2*T32 + T41, T52 + T61 - 4*T62 + 5478, 2*T23 + T32 - (1876*T33)/5 + T43 + 352640]
[T31 + 2*T42 + T51, T32 + T41 - 4*T42 + T43 + T52, 2*T33 + T42 - (1876*T43)/5 + T53 + 352640]
[T41 + 2*T52 + T61, 2*T42 + 2*T51 - (1886*T52)/5 + T53 + T62 + 352640, T43 + T52 - (1866*T53)/5 + 352640]
[T51 + 2*T62 + 400, 2*T52 + T61 - (1876*T62)/5 + 353040, 950]
[ 400, 400, 950]
]
B = 
mask = hasSymType(B, 'variable')
mask = 7×3 logical array
0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
[X, b] = equationsToMatrix(B(mask))
X = 
b = 
Y = inv(X)
Y = 
T=double(Y*b)
T = 14×1
1.0e+03 * -4.0262 -0.2660 0.9438 0.1319 1.6185 0.9517 0.7892 1.0729 0.9503 -2.2777

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by