开发者

Trying to solve 2D truss structure, error: Warning: Solution does not exist because the system is inconsistent

开发者 https://www.devze.com 2022-12-07 19:30 出处:网络
Trying to make a systems of equations to solve the internal forces of a truss in the x and y plane, and get the error that my system is inconsistent. I have double checked multiple times and I\'m not

Trying to make a systems of equations to solve the internal forces of a truss in the x and y plane, and get the error that my system is inconsistent. I have double checked multiple times and I'm not quite sure what I'm missing, any tips?

Here is code:

clc, clear all;

syms FAB FBC FCD FDE FEF FFG FGH FAI FCI FHI FBI FCG FCF FDF FGI Ay Ex Ey;

theta1 = atand(4/10); %theta for all members

%creating vectors for all internal member directions

VecFAB = FAB*[1 0];

VecFBC = FBC*[1 0];

VecFCD = FCD*[1 0];

VecFDE = FDE*[1 0];

VecFEF= FEF*[cosd(theta1) sind(theta1)];

VecFFG = FFG*[cosd(theta1) sind(theta1)];

VecFGH = FGH*[cosd(theta1) sind(theta1)];

VecFAI = FAI*[cosd(theta1) sind(theta1)];

VecFCI = FCI*[cosd(theta1) sind(theta1)];

VecFCF = FCF*[cosd(theta1) sind(theta1)];

VecFGI = FGI*[cosd(theta1) sind(theta1)];

VecFHI = FHI*[0 1];

VecFBI = FBI*[0 1];

VecFCG = FCG*[0 1];

VecFDF = FDF*[0 1];

RA = Ay*[0 1];

RE = Ey*[0 1] + Ex*[1 0];

F1 = 2000*[1 0];

F2 = 1500*[1 0];

F3 = 3000*[0 -1];

F4 = 3000*[0 -1];

%create equations at given points

FA = VecFAB + VecFAI + RA + 0*(VecFAB+VecFBC+VecFCD+VecFDE+VecFEF+VecFFG+VecFGH+VecFAI+VecFCI+VecFCF+VecFGI+VecFDF+VecFCG+VecFBI+VecFHI+RA+RE);

FB = VecFAB + VecFBI + VecFBC + 0*(VecFAB+VecFBC+VecFCD+VecFDE+VecFEF+VecFFG+VecFGH+VecFAI+VecFCI+VecFCF+VecFGI+VecFDF+VecFCG+VecFBI+VecFHI+RA+RE);

FC = VecFBC + VecFCI + VecFCD + VecFCF + VecFCG + 0*(VecFAB+VecFBC+VecFCD+VecFDE+VecFEF+VecFFG+VecFGH+VecFAI+VecFCI+VecFCF+VecFGI+VecFDF+VecFCG+VecFBI+VecFHI+RA+RE);

FD = VecFDF + VecFCD + VecFDE + 0*(VecFAB+VecFBC+VecFCD+VecFDE+VecFEF+VecFFG+VecFGH+VecFAI+VecFCI+VecFCF+VecFGI+VecFDF+VecFCG+VecFBI+VecFHI+RA+RE);

FE = RE + VecFEF + VecFDE + 0*(VecFAB+VecFBC+VecFCD+VecFDE+VecFEF+VecFFG+VecFGH+VecFAI+VecFCI+VecFCF+VecFGI+VecFDF+VecFCG+VecFBI+VecFHI+RA+RE);

FF = F4 + VecFEF + VecFFG + VecFDF + VecFCF + 0*(VecFAB+VecFBC+VecFCD+VecFDE+VecFEF+VecFFG+VecFGH+VecFAI+VecFCI+VecFCF+VecFGI+VecFDF+VecFCG+VecFBI+VecFHI+RA+RE);

FG = F3 + VecFFG + VecFGH + VecFGI + VecFCG + 0*(VecFAB+VecFBC+VecFCD+VecFDE+VecFEF+VecFFG+VecFGH+VecFAI+VecFCI+VecFCF+VecFGI+VecFDF+VecFCG+VecFBI+VecFHI+RA+RE);

FH = F1 + VecFHI + VecFGH + 0*(VecFAB+VecFBC+VecFCD+VecFDE+VecFEF+VecFFG+VecFGH+VecFAI+VecFCI+VecFCF+VecFGI+VecFDF+VecFCG+VecFBI+VecFHI+RA+RE);

FI = F2 + VecFBI + VecFHI + VecFAI + VecFCI + VecFGI + 0*(VecFAB+VecFBC+VecFCD+VecFDE+VecFEF+VecFFG+VecFGH+VecFAI+VecFCI+VecFCF+VecFGI+VecFDF+VecFCG+VecFBI+VecFHI+RA+RE);

%break into x and y components

EQNFAX = FA(1)==0; EQNFAY = FA(2)==0;

EQNFBX = FB(1)==0; EQNFBY = FB(2)==0;

EQNFCX = FC(1)==0; EQNFCY = FC(2)==0;

EQNFDX = FD(1)==0; EQNFDY = FD(2)==0;

EQNFEX = FE(1)==0; EQNFEY = FE(2)==0;

EQNFFX = FF(1)==0; EQNFFY = FF(2)==0;

EQNFGX = FG(1)==0; EQNFGY = FG(2)==0;

EQNFHX = FH(1)==0; EQNFHY = FH(2)==0;

EQNFIX = FI(1)==0; EQNFIY = FI(2)==0;

[A,B] = equationsToMatrix([EQNFAX,EQNFAY,EQNFBX,EQNFBY,EQNFCX,EQNFCY,EQNFDX,EQNFDY,EQNFEX,EQNFEY,EQNFFX,EQNFFY,EQNFGX,EQNFGY,EQNFHX,EQNFHY,EQNFIX,EQNFIY],[FAB,FBC,FCD,FDE,FEF,FFG,FGH,FAI,FCI,FHI,FBI,FCG,FCF,FDF,FGI,Ay,Ex,Ey]);

solution = linsolve(A,B)

I have tried double checking all my equations, as well as the vectors that represent them, and still no dice. I have done this before on a problem to solve force and reaction forces in 3 dimensions and had less trouble, the code is below if it might help.

clear all, clc

syms Ax Ay Bx Bz Cz F2 %Cy is not present because the problem states that Cy = 0

F1 = 300; %given F1 value

rF2 = [cos(45pi/180)sin(30pi/180) cos(45pi/180)cos(30pi/180) -sin(45*pi/180)]; %using given angles, break F1 and F2 down into x, y, and z direction

rF1 = [0 -cos(45pi/180) -sin(45pi/180)];

uF1 = rF1/norm(rF1); %create unit vectors for F1 and F2 so that they can be broken down into x, y, and z components

uF2 = rF2/norm(rF2);

vecF1 = F1*uF1; %create the vector forms of F1 and F2 by multiplying the unit vector by F1 and F2 respectively

vecF2 = F2*uF2;

vecAx = Ax*[1 0 0]; %multiply Ax, Ay, Bx, Bz, and Cz by their respective unit in matrix form, to create correct syntax for code

vecAy = Ay*[0 1 0];

vecBx = Bx*[1 0 0];

vecBz = Bz*[0 0 1];

vecCz = Cz*[0 0 1];

sumF = vecF1 + vecF2 + vecAx + vecAy + vecBx + vecBz + vecCz; %create main sum of forces equation to be broken down into x, y, z components

eqn1=sumF(1)==0; %create equations equivalent to sum of forces in x, y, and z using matrix made by sumF eqn2=sumF(2)==0; eqn3=sumF(3)==0;

rF1_D = [0 -5 5]; %find distance from created point 'D' (where F2 lies) to use for moment calculation

rF2_D = [0 0 0];

rA_D = [0 -5 4];

rB_D = [0 -3 0];

rC_D = [-5 0 0];

sumM = (cross(vecF1, rF1_D) + cross(vecF2, rF2_D)) ...

  • (cross(vecAx, rA_D) + cross(vecAy, rA_D) + cross(vecBx, rB_D) + cross(vecBz, rB_D) ...
  • cross(vecCz, rC_D)); %create the sum of moments main equation in matrix form to be broken down into x, y, and z components using the cross product of each vector with the distance from point D

eqn4=sumM(1)==0; %create equations equivalent to the sum of moments at x, y, and z eqn5=sumM(2)==0; eqn6=开发者_Python百科sumM(3)==0;

[A,B] = equationsToMatrix([eqn1 eqn2 eqn3 eqn4 eqn5 eqn6], [Ax Ay Bx Bz Cz F2]); %creating a matrix based on the sum of forces and sum of moment equations, solving for reaction forces and F2

solution = linsolve(A,B); %solving matrix for reaction forces and f2

F2=round(solution(6),3) %printed F2; solution was a very long fraction, simplified to 3 decimals

0

精彩评论

暂无评论...
验证码 换一张
取 消