'sym' returns val = k11
    1 visualización (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Justin
 el 26 de Oct. de 2022
  
    
    
    
    
    Respondida: Torsten
      
      
 el 26 de Oct. de 2022
            I am trying to obtain each of the k values in the K_bar matrix but it returns this instead: 
val = 
k12
A_bar and B_bar are 6x6 and 6x2 matrices respectively, desired_A is a 6x6 matrix
syms k11 k12 k13 k14 k15 k16 k21 k22 k23 k24 k25 k26
K_bar = [k11 k12 k13 k14 k15 k16; k21 k22 k23 k24 k25 k26];
desired_A = [0 1 0 0 0 0;
    0 0 1 0 0 0;
    0 0 0 1 0 0;
    0 0 0 0 1 0;
    0 0 0 0 0 1;
    P_1(1,1) P_1(2,1) P_1(3,1) P_1(4,1) P_1(5,1) P_1(6,1)];
solve(A_bar-B_bar*K_bar == desired_A)
2 comentarios
  Torsten
      
      
 el 26 de Oct. de 2022
				We cannot run your code since P_1, A_bar and B_bar are not included.
Specify the variables to be solved for in the solve-command:
solve(A_bar-B_bar*K_bar == desired_A,[....])
Respuesta aceptada
  Torsten
      
      
 el 26 de Oct. de 2022
        As you can see, there are 36 equations for 12 variables. A solution only exists that approximately satisfies the equations.
syms k11 k12 k13 k14 k15 k16 k21 k22 k23 k24 k25 k26
K_bar = [k11 k12 k13 k14 k15 k16; k21 k22 k23 k24 k25 k26];
P_1 = [-17.5458
    -10.9961
    -5.9298
    2.4755
    0.5145
    0.2144];
A_bar = [2.27373675443232e-13	1.00000000000006	-2.27373675443232e-13	3.90798504668055e-14	-1.77635683940025e-15	-6.55031584528842e-15
    -137.734459766021	-31.4382876387425	90.5288917845223	5.50401138702667	0.233058235255689	-0.0318858055012502
    -9.09494701772928e-13	-2.27373675443232e-13	0	1.00000000000009	3.99680288865056e-15	-1.49880108324396e-14
    9.09494701772928e-12	1.59161572810262e-12	-7.27595761418343e-12	5.68434188608080e-14	0.999999999999989	-3.66373598126302e-14
    4.80213202536106e-10	9.09494701772928e-11	-3.18323145620525e-10	-6.70752342557535e-12	-8.10018718766514e-13	1.00000000000012
    20062.3834043088	3782.74771918441	-13184.1581254876	-293.869135173145	-0.661269979650289	0.170971388595087];
B_bar = [0.000523048989000699	-2.71050543121376e-20
    -0.000854211683516470	2.71050543121376e-20
    0.000569896798913104	2.71050543121376e-20
    -0.000851129445196858	-5.42101086242752e-19
    0.00186262474795345	0.00842710999609239
    0.0139115491920225	0.0325937275319102];
desired_A = [0 1 0 0 0 0;
    0 0 1 0 0 0;
    0 0 0 1 0 0;
    0 0 0 0 1 0;
    0 0 0 0 0 1;
    P_1(1,1) P_1(2,1) P_1(3,1) P_1(4,1) P_1(5,1) P_1(6,1)];
[A,b] = equationsToMatrix(A_bar-B_bar*K_bar - desired_A==0,[k11 k12 k13 k14 k15 k16 k21 k22 k23 k24 k25 k26]);
A = double(A);
b = double(b);
k = A\b
k = k.';
sum((double(A_bar - B_bar*[k(1:6);k(7:12)]-desired_A)).^2,'all')
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

