필터 지우기
필터 지우기

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

조회 수: 2 (최근 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