How to solve matrices with 6 unknowns?

I have two matrices as shown below. I need to equate the individual elements (e.g. Ad(1,1)=Af(1,1),Ad(1,2)=Af(1,2),etc.) which forms different set of equations (9 equations to be exact), then afterwards I need to solve these system of equations simultaneously to get the values of K11,K12,K13,K21,K22 and K23. Could you suggest any method to do this in Matlab?
Ad =
-1 0 0
0 0 1
0 -6 -5
Af = [(-K11-1) (-K12+7) -K13;0 0 1;-K21 (-K22-2) (3-K23)]

 Accepted Answer

Ad = [ -1 0 0
0 0 1
0 -6 -5] ;
syms K11 K12 K13 K21 K22 K23
Af = [(-K11-1) (-K12+7) -K13;0 0 1;-K21 (-K22-2) (3-K23)] ;
eqn = Af==Ad
sol = solve(eqn)

8 Comments

Thanks. The matrix was equated, but the values of K11 K12 K13 K21 K22 K23 was not evaluated?
It is evaluated..:)
sol.K11 sol.K12 etc.. have values.
Hi, I tried it with my new set of equations with K11, K12, etc being coupled with each other on the matrix equations and don't know why K11, K12, etc dont give an answer when I use the sol.K11, etc. Do you have idea whats going on?
Abar = (1.0e+03)*[0.0000 0.0010 0 -0.0000; 0.4933 -0.0328 -2.7489 0.1412; -0.0000 -0.0000 0.0000 0.0010; 0.1159 -0.0028 -0.6435 0.0081]
Bbar = (1.0e+03)*[-0.2854 -0.1664; 6.0167 3.1306; -0.0416 -0.0258; 1.0730 0.5628]
Kbar = [K11, K12, K13, K14; K21, K22, K23, K24];Af = Abar - Bbar*Kbar
Af = Abar - Bbar*Kbar
Ad =[0 1 0 0; 0 0 1 0; 0 0 0 1; -2.0160 -0.7 -4.41 -3.6];
eqn = Af==Ad
sol = solve(eqn)
YOu need to define unknowns in syms
Thanks for the response. Yeah I did define it, however, the final form of "eqn" will be as show below. As you can see, each cell of the matrix will now be coupled with different K11 and K21 which is not the case as what I posted previously :) sol.K11, etc don't give answers now when I executed it. Will appreciate your feedback on this.
[ (1427*K11)/5 + (832*K21)/5 == 0, (1427*K12)/5 + (832*K22)/5 + 1 == 1, (1427*K13)/5 + (832*K23)/5 == 0, (1427*K14)/5 + (832*K24)/5 == 0]
[ 4933/10 - (15653*K21)/5 - (60167*K11)/10 == 0, - (60167*K12)/10 - (15653*K22)/5 - 164/5 == 0, - (60167*K13)/10 - (15653*K23)/5 - 27489/10 == 1, 706/5 - (15653*K24)/5 - (60167*K14)/10 == 0]
[ (208*K11)/5 + (129*K21)/5 == 0, (208*K12)/5 + (129*K22)/5 == 0, (208*K13)/5 + (129*K23)/5 == 0, (208*K14)/5 + (129*K24)/5 + 1 == 1]
[ 1159/10 - (2814*K21)/5 - 1073*K11 == -252/125, - 1073*K12 - (2814*K22)/5 - 14/5 == -7/10, - 1073*K13 - (2814*K23)/5 - 1287/2 == -441/100, 81/10 - (2814*K24)/5 - 1073*K14 == -18/5]
Abar = (1.0e+03)*[0.0000 0.0010 0 -0.0000; 0.4933 -0.0328 -2.7489 0.1412; -0.0000 -0.0000 0.0000 0.0010; 0.1159 -0.0028 -0.6435 0.0081] ;
Bbar = (1.0e+03)*[-0.2854 -0.1664; 6.0167 3.1306; -0.0416 -0.0258; 1.0730 0.5628] ;
Ad =[0 1 0 0; 0 0 1 0; 0 0 0 1; -2.0160 -0.7 -4.41 -3.6];
Kbar = Bbar\(Abar-Ad) ;
Hi KSSV, This is a great help. Thank you so much! It worked.

Sign in to comment.

More Answers (0)

Tags

Asked:

on 1 Nov 2017

Commented:

on 1 Nov 2017

Community Treasure Hunt

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

Start Hunting!