MATLAB: How would i solve for t2 and t3 in the last matrix? ive never dealt with variables in matrices before.

matricesmatrixvariables

l1 = .1; %m


l2 = .06; %m
l3 = .08; %m
k1 = 5 ; %W/m*C


k2 = .8 ; %W/m*C
k3 = 15 ; %W/m*C
K1 = (k1/l1) * [1 -1 ; -1 1] %W/C


K2 = (k2/l2) * [1 -1 ; -1 1] %W/C
K3 = (k3/l3) * [1 -1 ; -1 1] %W/C
kg = [ K1(1,1) K1(1,2) 0 0 ;
K1(2,1) (K1(2,2)+K2(1,1)) K2(1,2) 0 ;
0 K2(2,1) (K2(2,2)+K3(1,1)) K3(1,2);
0 0 K3(2,1) K3(2,2)]
f = [ 0;0;0;0]
t= [500 ; t2 ; t3 ; 100 ]
f = kg * t

Best Answer

  • Sorry. But no solution exists. You have 4 equations, in only two unknowns.
    l1 = .1; %m


    l2 = .06; %m
    l3 = .08; %m
    k1 = 5 ; %W/m*C


    k2 = .8 ; %W/m*C
    k3 = 15 ; %W/m*C
    K1 = (k1/l1) * [1 -1 ; -1 1] %W/C


    K2 = (k2/l2) * [1 -1 ; -1 1] %W/C
    K3 = (k3/l3) * [1 -1 ; -1 1] %W/C
    kg = [ K1(1,1) K1(1,2) 0 0 ;
    K1(2,1) (K1(2,2)+K2(1,1)) K2(1,2) 0 ;
    0 K2(2,1) (K2(2,2)+K3(1,1)) K3(1,2);
    0 0 K3(2,1) K3(2,2)]
    f = [ 0;0;0;0]
    syms t2 t3
    t= [500 ; t2 ; t3 ; 100 ]
    Now, look at kg*t.
    kg*t
    ans =
    25000 - 50*t2
    (190*t2)/3 - (40*t3)/3 - 25000
    (1205*t3)/6 - (40*t2)/3 - 18750
    18750 - (375*t3)/2
    Each of those result must be equal to 0. So 4 equations. But only two unknowns: t2 and t3.
    No solution exists.
    t23 = solve(f == kg*t)
    t23 =
    struct with fields:
    t2: [0×1 sym]
    t3: [0×1 sym]
    As you can see, MATLAB tells us no solution exists. t2 and t3 are empty.