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
Afficher commentaires plus anciens
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 commentaires
Dyuman Joshi
le 4 Mar 2023
The first line is incomplete.
If q_1, q_2, ... are 1x11 double, then you can not define equ as a matrix, as dimensions will not match.
Did you mean 1x1 double i.e. scalar values?
kaixi gu
le 4 Mar 2023
Dyuman Joshi
le 4 Mar 2023
Modifié(e) : Dyuman Joshi
le 4 Mar 2023
"But i want the each value of that q_1,q_2 into the matrix to find the coresponding sol for each value of q_1.q_2."
I do not understand this statement.
What are the known values? and which variables are unknown, whose values you want to find?
Attach or copy-paste any data you have relevant to this code (use the paperclip button to attach)
The ‘equ’ matrix still has the same problem it did when you posted this previously.
All the column lengths in each row have to be equal, however they range from 25 to 32. This will not work until you fix that problem. It has to have a uniform column size that is compatible with whatever else you are using it with.
sequ = '[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]';
colends = strfind(sequ,';');
collens = diff([0 colends])
.
kaixi gu
le 4 Mar 2023
Shree Charan
le 7 Avr 2023
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.
Réponses (1)
埃博拉酱
le 7 Avr 2023
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
Catégories
En savoir plus sur Linear Algebra dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!