My appdesigner application stops in the process !

1 view (last 30 days)
Good morning everyone.
I've been making an app for 3d trusses analysis in appdesigner and I've finished it.
When I analyse small trusses like the one below, my app works without problems.
However, when I want to analyse relatively large trusses, matlab appdesginer stops in the process and does not respond to any command, so the only solution is to close it with the task manager. I would like to know what is the main reason for this problem.
In my opinion there are two processes in my application that I must highlight.
  1. The first would be the assembly of the system of linear equations and its solution, which becomes larger as the truss grows.
  2. The second would be the graphical outputs as shown in the image and a small animation of how the structure deforms.
For the first process, I use for cycles to assemble the matrices and the linsolve command to solve the system of equations.
for i = 1:app.EditField2.Value
P = [3*DT21(i,1)-2,3*DT21(i,1)-1,3*DT21(i,1),3*DT21(i,2)-2,3*DT21(i,2)-1,3*DT21(i,2)];
CX2 = CX(i)^2;
CXCY = CX(i) * CY(i);
CXCZ = CX(i) * CZ(i);
CYCX = CY(i) * CX(i);
CY2 = CY(i)^2;
CYCZ = CY(i) * CZ(i);
CZCX = CZ(i) * CX(i);
CZCY = CZ(i) * CY(i);
CZ2 = CZ(i)^2;
MA = [CX2 CXCY CXCZ;CYCX CY2 CYCZ;CZCX CZCY CZ2];
ML(:,:,i) = ((DT22(i,1) * DT22(i,2)) / DT22(i,3)) .* [MA -MA;-MA MA];
for j = 1:6
for k = 1:6
MG(P(j),P(k),i) = ML(j,k,i);
end
end
end
MG = sum(MG,3);
app.UITable3.Data = MG; % GLOBAL MATRIX
F = [DT11(:,4)';DT11(:,5)';DT11(:,6)'];
F = F(:);
U = zeros(3*app.EditField1.Value,1);
I = [strcmp(app.UITable1.Data(:,4),'Libre')';strcmp(app.UITable1.Data(:,5),'Libre')';strcmp(app.UITable1.Data(:,6),'Libre')'];
I = I(:);
if det(MG(I,I)) == 0
app.TextArea1.Value = 'La matriz a resolver es singular, por lo que los resultados seran nada precisos';
else
app.TextArea1.Value = 'El analisis matricial a sido realizado con exito';
end
R = linsolve(MG(I,I),F(I)); % LINEAL SYSTEM
U(I) = R; % FORCES
F = MG * U; % DISPLACEMENTS
For the second process I only use the plot3 command and for the animation I combine it with a for.
for j = linspace(0,app.EditField3.Value,app.EditField4.Value)
cla(app.UIAxes2)
k = k + 1;
D = j .* U;
CM = VCM(k) .* colormap(app.UIAxes2,'jet');
CI = round(interp1([min(E) max(E)],[1 256],E));
DT11 = cell2mat(app.UITable1.Data(:,1:3)) + [D(1:3:3*app.EditField1.Value) D(2:3:3*app.EditField1.Value) D(3:3:3*app.EditField1.Value)];
for i = 1:app.EditField2.Value
plot3(app.UIAxes2,[DT11(DT21(i,1),1);DT11(DT21(i,2),1)],[DT11(DT21(i,1),2);DT11(DT21(i,2),2)],[DT11(DT21(i,1),3);DT11(DT21(i,2),3)],'Color',CM(CI(i),:),'LineWidth',3.5);
end
DT11 = cell2mat(app.UITable1.Data(:,1:3));
plot3(app.UIAxes2,[DT11(DT21(:,1),1)';DT11(DT21(:,2),1)'],[DT11(DT21(:,1),2)';DT11(DT21(:,2),2)'],[DT11(DT21(:,1),3)';DT11(DT21(:,2),3)'],'--c','LineWidth',3.5);
DT11 = cell2mat(app.UITable1.Data(:,1:3)) + [D(1:3:3*app.EditField1.Value) D(2:3:3*app.EditField1.Value) D(3:3:3*app.EditField1.Value)];
DT12 = app.UITable1.Data(:,4:6);
plot3(app.UIAxes2,DT11(strcmp(DT12(:,1),'Fijo'),1),DT11(strcmp(DT12(:,1),'Fijo'),2),DT11(strcmp(DT12(:,1),'Fijo'),3),'or','MarkerSize',10,'MarkerFaceColor',[1 0 0]);
plot3(app.UIAxes2,DT11(strcmp(DT12(:,2),'Fijo'),1),DT11(strcmp(DT12(:,2),'Fijo'),2),DT11(strcmp(DT12(:,2),'Fijo'),3),'or','MarkerSize',10,'MarkerFaceColor',[1 0 0]);
plot3(app.UIAxes2,DT11(strcmp(DT12(:,3),'Fijo'),1),DT11(strcmp(DT12(:,3),'Fijo'),2),DT11(strcmp(DT12(:,3),'Fijo'),3),'or','MarkerSize',10,'MarkerFaceColor',[1 0 0]);
axis(app.UIAxes2,'equal')
pause(app.EditField5.Value)
end
I would understand that my application stops in the animation, but it stops when I am just entering data or adding rows in the tables to add nodes or structural elements.
So I would come to the conclusion that the problem is in the characteristics of my machine, but I have developed much larger and more complex applications in which I use the symbolic toolbox (which is slower to solve equations) and my application works normally and basically do the same thing (solve systems of equations and display the results graphically).
Well, without further ado, I hope someone can tell me if the problem is that my code is too inefficient or if I should buy a more powerful machine, and if so, what requirements it should have. Thank you very much

Answers (0)

Categories

Find more on Thermal Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!