in this linear matrix. q_1, q_2....the input matrix are 1*11 double. all the F2y,F3x...in the out put are 1*11 double. I want to solve the Sol for each value of input ,output

1 次查看(过去 30 天)
N = numel()
equ = [0 1 0 -1 0 0 0 0 0 0 0 -1;1 0 -1 0 0 0 0 0 0 0 -1 0;0 0 0 0 0 0 0 1 0 -1 0 1;0 0 0 0 0 0 1 0 -1 0 1 0;0 0 0 0 1 0 -1 0 0 0 0 0;0 0 0 0 0 1 0 -1 0 0 0 0;0 0 1 0 -1 0 0 0 0 0 0 0;0 0 0 1 0 -1 0 0 0 0 0 0;0 0 q_4 q_3 0 0 0 0 0 0 q_2 q_1;0 0 0 0 0 0 q_6 q_5 0 0 q_8 q_7;0 0 0 0 q_10 q_9 0 0 0 0 0 0;0 0 q_12 q_11 0 0 0 0 0 0 0 0]
equ_2 = [F2y;F2x;F3y;F3x;F4x;F4y;F5x;F5y;F6x;F6y;M_1;M_2:M_3;M_4];
Sol = inv(equ)*equ_2;
  6 个评论
kaixi gu
kaixi gu 2023-3-4
yes i know i can not put a 1*11douuble into the matrx. But is there any ways i can use the loop or something to make each value of q and each value of F into the matrix? If I manualy put each value of q and each value of F2y. I would probably need to type the matrix 121 times. I certainly just want each value of q for the corespondinbg each value of F
Shree Charan
Shree Charan 2023-4-7
Could you please explain 'to make each value of q and each value of F into the matrix' and 'I certainly just want each value of q for the corespondinbg each value of F'. It might be useful to provide an example.

请先登录,再进行评论。

回答(1 个)

埃博拉酱
埃博拉酱 2023-4-7
Sol=cell(1,11);
for a=1:11
Sol{a}=GetOneSol(q_1(a),q_2(a),q_3(a),q_4(a),q_5(a),q_6(a),q_7(a),q_8(a),q_9(a),q_10(a),q_11(a),q_12(a),F2y(a),F2x(a),F3y(a),F3x(a),F4x(a),F4y(a),F5x(a),F5y(a),F6x(a),F6y(a),M_1,M_2,M_3,M_4);
end
function Sol=GetOneSol(q_1,q_2,q_3,q_4,q_5,q_6,q_7,q_8,q_9,q_10,q_11,q_12,F2y,F2x,F3y,F3x,F4x,F4y,F5x,F5y,F6x,F6y,M_1,M_2,M_3,M_4)
equ = [0 1 0 -1 0 0 0 0 0 0 0 -1;1 0 -1 0 0 0 0 0 0 0 -1 0;0 0 0 0 0 0 0 1 0 -1 0 1;0 0 0 0 0 0 1 0 -1 0 1 0;0 0 0 0 1 0 -1 0 0 0 0 0;0 0 0 0 0 1 0 -1 0 0 0 0;0 0 1 0 -1 0 0 0 0 0 0 0;0 0 0 1 0 -1 0 0 0 0 0 0;0 0 q_4 q_3 0 0 0 0 0 0 q_2 q_1;0 0 0 0 0 0 q_6 q_5 0 0 q_8 q_7;0 0 0 0 q_10 q_9 0 0 0 0 0 0;0 0 q_12 q_11 0 0 0 0 0 0 0 0]
equ_2 = [F2y;F2x;F3y;F3x;F4x;F4y;F5x;F5y;F6x;F6y;M_1;M_2:M_3;M_4];
Sol = inv(equ)*equ_2;
end

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by