-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModulo5.m
3877 lines (3479 loc) · 195 KB
/
Modulo5.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
classdef Modulo5_exported < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TabGroup matlab.ui.container.TabGroup
Tab1 matlab.ui.container.Tab
StateButton14 matlab.ui.control.StateButton
EditField28 matlab.ui.control.NumericEditField
PesodelEjeLabel matlab.ui.control.Label
EditField27 matlab.ui.control.NumericEditField
CentrodeMasaLabel matlab.ui.control.Label
Label1 matlab.ui.control.Label
Label4 matlab.ui.control.Label
Label3 matlab.ui.control.Label
Label2 matlab.ui.control.Label
EditField1 matlab.ui.control.NumericEditField
NodosLabel matlab.ui.control.Label
UITable2 matlab.ui.control.Table
UITable1 matlab.ui.control.Table
UIAxes1 matlab.ui.control.UIAxes
Tab3 matlab.ui.container.Tab
HTML1 matlab.ui.control.HTML
UITable16 matlab.ui.control.Table
Label51 matlab.ui.control.Label
Button23 matlab.ui.control.Button
EditField29 matlab.ui.control.NumericEditField
RPMdelejeLabel matlab.ui.control.Label
EditField26 matlab.ui.control.NumericEditField
AltociclajeLabel matlab.ui.control.Label
Label50 matlab.ui.control.Label
UITable5 matlab.ui.control.Table
EditField25 matlab.ui.control.NumericEditField
deconfiabilidadLabel matlab.ui.control.Label
EditField24 matlab.ui.control.NumericEditField
TemperaturadetrabajoLabel matlab.ui.control.Label
Label49 matlab.ui.control.Label
Label48 matlab.ui.control.Label
Label47 matlab.ui.control.Label
Label46 matlab.ui.control.Label
Label45 matlab.ui.control.Label
Image5 matlab.ui.control.Image
Image4 matlab.ui.control.Image
Image3 matlab.ui.control.Image
Image2 matlab.ui.control.Image
Image1 matlab.ui.control.Image
UITable4 matlab.ui.control.Table
Label6 matlab.ui.control.Label
UIAxes10 matlab.ui.control.UIAxes
Tab4 matlab.ui.container.Tab
TextArea1 matlab.ui.control.TextArea
Button25 matlab.ui.control.Button
DropDown32 matlab.ui.control.DropDown
DropDown31 matlab.ui.control.DropDown
Button24 matlab.ui.control.Button
UITable14 matlab.ui.control.Table
Label54 matlab.ui.control.Label
Button22 matlab.ui.control.Button
Button21 matlab.ui.control.Button
DropDown30 matlab.ui.control.DropDown
DropDown29 matlab.ui.control.DropDown
DropDown28 matlab.ui.control.DropDown
Button20 matlab.ui.control.Button
Button19 matlab.ui.control.Button
Button18 matlab.ui.control.Button
DropDown2 matlab.ui.control.DropDown
DropDown1 matlab.ui.control.DropDown
PlanoLabel matlab.ui.control.Label
Button1 matlab.ui.control.Button
Label7 matlab.ui.control.Label
UITable3 matlab.ui.control.Table
UIAxes11 matlab.ui.control.UIAxes
UIAxes9 matlab.ui.control.UIAxes
UIAxes8 matlab.ui.control.UIAxes
Tab10 matlab.ui.container.Tab
Button31 matlab.ui.control.Button
Button30 matlab.ui.control.Button
Button29 matlab.ui.control.Button
Button28 matlab.ui.control.Button
Label57 matlab.ui.control.Label
Label58 matlab.ui.control.Label
Label56 matlab.ui.control.Label
Label55 matlab.ui.control.Label
Slider2 matlab.ui.control.Slider
Slider1 matlab.ui.control.Slider
Button27 matlab.ui.control.Button
UITable15 matlab.ui.control.Table
DropDown33 matlab.ui.control.DropDown
EditField32 matlab.ui.control.NumericEditField
FramesLabel matlab.ui.control.Label
EditField31 matlab.ui.control.NumericEditField
EscalaLabel matlab.ui.control.Label
Button26 matlab.ui.control.Button
UIAxes16 matlab.ui.control.UIAxes
ContextMenu1 matlab.ui.container.ContextMenu
submenu11 matlab.ui.container.Menu
submenu12 matlab.ui.container.Menu
submenu13 matlab.ui.container.Menu
submenu14 matlab.ui.container.Menu
submenu15 matlab.ui.container.Menu
submenu16 matlab.ui.container.Menu
submenu17 matlab.ui.container.Menu
submenu18 matlab.ui.container.Menu
submenu19 matlab.ui.container.Menu
submenu20 matlab.ui.container.Menu
ContextMenu2 matlab.ui.container.ContextMenu
submenu21 matlab.ui.container.Menu
submenu211 matlab.ui.container.Menu
submenu212 matlab.ui.container.Menu
submenu22 matlab.ui.container.Menu
submenu221 matlab.ui.container.Menu
submenu222 matlab.ui.container.Menu
submenu23 matlab.ui.container.Menu
submenu231 matlab.ui.container.Menu
submenu232 matlab.ui.container.Menu
ContextMenu3 matlab.ui.container.ContextMenu
submenu31 matlab.ui.container.Menu
submenu32 matlab.ui.container.Menu
ContextMenu4 matlab.ui.container.ContextMenu
submenu41 matlab.ui.container.Menu
submenu42 matlab.ui.container.Menu
ContextMenu5 matlab.ui.container.ContextMenu
submenu51 matlab.ui.container.Menu
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
global L1 L2 L3 L4 S1 S2 S3 S4 S5 S6 change_cmap esforfac bernotimo
change_cmap = 1;
esforfac = 1;
bernotimo = 0;
L1 = line(app.UIAxes1, [0 0], [0 0], 'LineWidth', 3, 'Color', [1 0 0]);
L2 = line(app.UIAxes1, [0 0], [0 0], 'LineWidth', 3, 'Color', [1 0 0]);
L3 = line(app.UIAxes10, [0 0], [0 0], 'LineWidth', 3, 'Color', [0 0 1]);
L4 = line(app.UIAxes10, [0 0], [0 0], 'LineWidth', 3, 'Color', [0 0 1]);
S1 = scatter(app.UIAxes1, [], [], 400, 'o', 'MarkerFaceColor', [1 1 1]);
S2 = scatter(app.UIAxes1, [], [], 400, '^', 'MarkerFaceColor', [1 1 1]);
S3 = scatter(app.UIAxes1, [], [], 400, 's', 'MarkerFaceColor', [1 1 1]);
S4 = scatter(app.UIAxes10, [], [], 400, 'o', 'MarkerFaceColor', [1 0 0]);
S5 = scatter(app.UIAxes10, [], [], 400, '^', 'MarkerFaceColor', [1 0 0]);
S6 = scatter(app.UIAxes10, [], [], 400, 's', 'MarkerFaceColor', [1 0 0]);
app.UITable1.Data = [0 0 0 0 0 2e11 77e9 250e6 400e6 7850 4];
app.UITable1.RowName = {['Tramo ', num2str(1)]};
app.UITable1.BackgroundColor = [0 0 0];
app.UITable1.ForegroundColor = [0 1 1];
Nodos = num2cell(zeros(1,2));
for i = 1:2
Nodos(i) = {['Nodo ', num2str(i)]};
end
app.UITable2.Data = num2cell(zeros(2, 7));
app.UITable3.Data = zeros(2, 8);
app.UITable14.Data = zeros(2, 8);
app.UITable4.Data = num2cell([zeros(2,6) ones(2,14)]);
app.UITable5.Data = num2cell(zeros(1, 8));
app.UITable2.Data(:,1) = {'Definir'};
app.UITable4.Data(:,5) = {'Definir'};
app.UITable4.Data(:,6) = {'Definir'};
app.UITable5.Data(:,1) = {'Definir'};
app.UITable15.Data = zeros(6,1);
app.UITable2.RowName = Nodos;
app.UITable3.RowName = Nodos;
app.UITable14.RowName = Nodos;
app.UITable4.RowName = Nodos;
app.UITable5.RowName = {['Tramo ', num2str(1)]};
app.UITable2.ColumnFormat = ({{'Ninguno' 'Simple' 'Elastico' 'Fijo'}});
app.UITable4.ColumnFormat(:,[5,6]) = ({{'Ninguno' 'Recocido' 'Revenido'}});
app.UITable5.ColumnFormat(:,1) = ({{'Ninguno' 'Esmerilado' 'Maquinado' 'Rolado en Caliente' 'Rolado en Frio' 'Forjado'}});
app.UITable2.BackgroundColor = [0 0 0];
app.UITable2.ForegroundColor = [0 1 1];
app.UITable3.BackgroundColor = [0 0 0];
app.UITable3.ForegroundColor = [0 1 1];
app.UITable14.BackgroundColor = [0 0 0];
app.UITable14.ForegroundColor = [0 1 1];
app.UITable15.BackgroundColor = [0 0 0];
app.UITable15.ForegroundColor = [0 1 1];
end
% Value changed function: EditField1
function EditField1ValueChanged(app, event)
global Nodos
app.UITable1.Data = ones(app.EditField1.Value - 1, 1) * app.UITable1.Data(1,:);
Tramos = num2cell(zeros(1,app.EditField1.Value - 1));
for i = 1:app.EditField1.Value - 1
Tramos(i) = {['Tramo ', num2str(i)]};
end
app.UITable1.RowName = Tramos;
Nodos = num2cell(zeros(1,app.EditField1.Value));
for i = 1:app.EditField1.Value
Nodos(i) = {['Nodo ', num2str(i)]};
end
app.UITable2.Data = num2cell(zeros(app.EditField1.Value, 7));
app.UITable3.Data = zeros(app.EditField1.Value, 8);
app.UITable14.Data = zeros(app.EditField1.Value, 8);
app.UITable4.Data = num2cell([zeros(app.EditField1.Value,6) ones(app.EditField1.Value,14)]);
app.UITable5.Data = num2cell(zeros(app.EditField1.Value - 1, 8));
app.UITable2.Data(:,1) = {'Definir'};
app.UITable4.Data(:,5) = {'Definir'};
app.UITable4.Data(:,6) = {'Definir'};
app.UITable5.Data(:,1) = {'Definir'};
app.UITable2.RowName = Nodos;
app.UITable3.RowName = Nodos;
app.UITable14.RowName = Nodos;
app.UITable4.RowName = Nodos;
app.UITable5.RowName = Tramos;
app.UITable2.ColumnFormat = ({{'Ninguno' 'Simple' 'Elastico' 'Fijo'}});
app.UITable4.ColumnFormat(:,[5,6]) = ({{'Ninguno' 'Recocido' 'Revenido'}});
app.UITable5.ColumnFormat(:,1) = ({{'Ninguno' 'Esmerilado' 'Maquinado' 'Rolado en Caliente' 'Rolado en Frio' 'Forjado'}});
end
% Value changed function: StateButton14
function StateButton14ValueChanged(app, event)
if app.StateButton14.Value == 1
app.StateButton14.Text = 'No incluir peso propio del eje';
app.StateButton14.FontColor = [0 0 0];
app.StateButton14.BackgroundColor = [0 1 1];
app.UITable1.Data(:,4) = app.UITable1.Data(:,4) - (pi/4 .* (app.UITable1.Data(:,2).^2 - app.UITable1.Data(:,3).^2)) .* app.UITable1.Data(:,10) * 9.81;
else
app.StateButton14.Text = 'Incluir peso propio del eje';
app.StateButton14.FontColor = [0 1 1];
app.StateButton14.BackgroundColor = [0 0 0];
app.UITable1.Data(:,4) = app.UITable1.Data(:,4) + (pi/4 .* (app.UITable1.Data(:,2).^2 - app.UITable1.Data(:,3).^2)) .* app.UITable1.Data(:,10) * 9.81;
end
end
% Cell selection callback: UITable1
function UITable1CellSelection(app, event)
global L1 L2 indices1
try
indices1 = event.Indices;
x4 = [0 cumsum(app.UITable1.DisplayData(:,1))'];
L1.XData = [x4(indices1(1)) x4(indices1(1) + 1)];
L2.XData = [0 0];
L2.YData = [0 0];
catch
end
end
% Display data changed function: UITable1
function UITable1DisplayDataChanged(app, event)
global L1 L2 L3 L4 S1 S2 S3 S4 S5 S6 indices1
cla(app.UIAxes1)
cla(app.UIAxes10)
axis(app.UIAxes1, 'equal');
axis(app.UIAxes10, 'equal');
x2 = cumsum(app.UITable1.DisplayData(:,1));
x1 = x2 - app.UITable1.DisplayData(:,1);
y1 = app.UITable1.DisplayData(:,2) ./ 2;
y2 = app.UITable1.DisplayData(:,3) ./ 2;
y3 = [y1(1); max([y1(1:length(y1)-1), y1(2:length(y1))], [], 2); y1(length(y1))];
x4 = [0 x2'];
Simp = strcmp(app.UITable2.Data(:,1), 'Simple');
Elas = strcmp(app.UITable2.Data(:,1), 'Elastico');
Fijo = strcmp(app.UITable2.Data(:,1), 'Fijo');
plot(app.UIAxes1, [0 x2'], 0, 'ow', 'LineWidth', 2, 'MarkerFaceColor', [1 1 1])
plot(app.UIAxes1, [x1 x2]', [y1 y1]', 'Color', [1 1 0], 'LineWidth', 2)
plot(app.UIAxes1, [x1 x2]', [-y1 -y1]', 'Color', [1 1 0], 'LineWidth', 2)
plot(app.UIAxes1, [[0 x2']; [0 x2']], [[0 y1']; [y1' 0]], 'Color', [1 1 0], 'LineWidth', 2)
plot(app.UIAxes1, [[0 x2']; [0 x2']], [[0 -y1']; [-y1' 0]], 'Color', [1 1 0], 'LineWidth', 2)
plot(app.UIAxes1, [x1 x2]', [y2 y2]', '--', 'Color', [1 1 0], 'LineWidth', 1.5)
plot(app.UIAxes1, [x1 x2]', [-y2 -y2]', '--', 'Color', [1 1 0], 'LineWidth', 1.5)
plot(app.UIAxes1, [[0 x2']; [0 x2']], [[0 y2']; [y2' 0]], '--', 'Color', [1 1 0], 'LineWidth', 1.5)
plot(app.UIAxes1, [[0 x2']; [0 x2']], [[0 -y2']; [-y2' 0]], '--', 'Color', [1 1 0], 'LineWidth', 1.5)
S1 = scatter(app.UIAxes1, x4(Simp), -y3(Simp), 400, 'o', 'MarkerFaceColor', [1 1 1]);
S2 = scatter(app.UIAxes1, x4(Elas), -y3(Elas), 400, '^', 'MarkerFaceColor', [1 1 1]);
S3 = scatter(app.UIAxes1, x4(Fijo), -y3(Fijo), 400, 's', 'MarkerFaceColor', [1 1 1]);
L1 = line(app.UIAxes1, [x4(indices1(1)) x4(indices1(1) + 1)], [0 0], 'LineWidth', 3, 'Color', [1 0 0]);
L2 = line(app.UIAxes1, [0 0], [0 0], 'LineWidth', 3, 'Color', [1 0 0]);
plot(app.UIAxes10, [0 x2'], 0, 'or', 'LineWidth', 2, 'MarkerFaceColor', [1 0 0])
plot(app.UIAxes10, [x1 x2]', [y1 y1]', 'Color', [0 0 0], 'LineWidth', 2)
plot(app.UIAxes10, [x1 x2]', [-y1 -y1]', 'Color', [0 0 0], 'LineWidth', 2)
plot(app.UIAxes10, [[0 x2']; [0 x2']], [[0 y1']; [y1' 0]], 'Color', [0 0 0], 'LineWidth', 2)
plot(app.UIAxes10, [[0 x2']; [0 x2']], [[0 -y1']; [-y1' 0]], 'Color', [0 0 0], 'LineWidth', 2)
plot(app.UIAxes10, [x1 x2]', [y2 y2]', '--', 'Color', [0 0 0], 'LineWidth', 1.5)
plot(app.UIAxes10, [x1 x2]', [-y2 -y2]', '--', 'Color', [0 0 0], 'LineWidth', 1.5)
plot(app.UIAxes10, [[0 x2']; [0 x2']], [[0 y2']; [y2' 0]], '--', 'Color', [0 0 0], 'LineWidth', 1.5)
plot(app.UIAxes10, [[0 x2']; [0 x2']], [[0 -y2']; [-y2' 0]], '--', 'Color', [0 0 0], 'LineWidth', 1.5)
S4 = scatter(app.UIAxes10, x4(Simp), -y3(Simp), 400, 'o', 'MarkerFaceColor', [1 0 0]);
S5 = scatter(app.UIAxes10, x4(Elas), -y3(Elas), 400, '^', 'MarkerFaceColor', [1 0 0]);
S6 = scatter(app.UIAxes10, x4(Fijo), -y3(Fijo), 400, 's', 'MarkerFaceColor', [1 0 0]);
L3 = line(app.UIAxes10, [0 0], [0 0], 'LineWidth', 3, 'Color', [0 0 1]);
L4 = line(app.UIAxes10, [0 0], [0 0], 'LineWidth', 3, 'Color', [0 0 1]);
Vol_Tra = (pi/4.* (app.UITable1.Data(:,2).^2 - app.UITable1.Data(:,3).^2)) .* app.UITable1.Data(:,1);
Mas_Tra = Vol_Tra .* app.UITable1.Data(:,10);
Xma_Tra = sum(Mas_Tra .* (app.UITable1.Data(:,1)./2 + [0;cumsum(app.UITable1.Data(1:app.EditField1.Value - 2,1))])) ./ sum(Mas_Tra);
plot(app.UIAxes1, Xma_Tra, 0, 'xc', 'MarkerSize', 20, 'MarkerFaceColor', [0 1 1], 'MarkerEdgeColor', [0 1 1])
if ~isnan(Xma_Tra)
app.EditField27.Value = Xma_Tra;
end
if ~isnan(Mas_Tra)
app.EditField28.Value = 9.81 * sum(Mas_Tra);
end
end
% Cell selection callback: UITable2
function UITable2CellSelection(app, event)
global L1 L2
try
indices = event.Indices;
y1 = app.UITable1.DisplayData(:,2) ./ 2;
x4 = [0 cumsum(app.UITable1.DisplayData(:,1))'];
L1.XData = [0 0];
L1.XData = [0 0];
L2.XData = [x4(indices(1)) x4(indices(1))];
L2.YData = [-max(abs(y1)) max(abs(y1))];
catch
end
end
% Cell edit callback: UITable2
function UITable2CellEdit(app, event)
global S1 S2 S3 S4 S5 S6
y1 = app.UITable1.DisplayData(:,2) ./ 2;
y3 = [y1(1); max([y1(1:length(y1)-1), y1(2:length(y1))], [], 2); y1(length(y1))];
x4 = [0 cumsum(app.UITable1.DisplayData(:,1))'];
Simp = strcmp(app.UITable2.Data(:,1), 'Simple');
Elas = strcmp(app.UITable2.Data(:,1), 'Elastico');
Fijo = strcmp(app.UITable2.Data(:,1), 'Fijo');
S1.XData = x4(Simp);
S1.YData = -y3(Simp);
S2.XData = x4(Elas);
S2.YData = -y3(Elas);
S3.XData = x4(Fijo);
S3.YData = -y3(Fijo);
S4.XData = x4(Simp);
S4.YData = -y3(Simp);
S5.XData = x4(Elas);
S5.YData = -y3(Elas);
S6.XData = x4(Fijo);
S6.YData = -y3(Fijo);
end
% Cell selection callback: UITable4
function UITable4CellSelection(app, event)
global L3 L4
try
indices = event.Indices;
y1 = app.UITable1.DisplayData(:,2) ./ 2;
x4 = [0 cumsum(app.UITable1.DisplayData(:,1))'];
L3.XData = [x4(indices(1)) x4(indices(1))];
L3.YData = [-max(abs(y1)) max(abs(y1))];
L4.XData = [0 0];
catch
end
end
% Cell edit callback: UITable4
function UITable4CellEdit(app, event)
bar_pro = uiprogressdlg(app.UIFigure,'Title','Porfavor espere','Message','Iniciando Calculos','Indeterminate','on');
bar_pro.Message = 'Validando caso ...';
indices = event.Indices;
newData = event.NewData;
if (indices(2) == 2 || indices(2) == 3) && (indices(1) ~= 1 && indices(1) ~= app.EditField1.Value)
app.UITable4.Data(indices(1),[1,4]) = {0};
app.UITable4.Data(indices(1),5:6) = {'Ninguno'};
else
if (indices(1) ~= 1 && indices(1) ~= app.EditField1.Value) || (indices(2) == 5 || indices(2) == 6)
app.UITable4.Data(indices(1),1:4) = {0};
app.UITable4.Data(indices(1),5:6) = {'Ninguno'};
end
end
if (indices(1) == 1 || indices(1) == app.EditField1.Value) && (indices(2) ~= 5 && indices(2) ~= 6)
app.UITable4.Data(indices(1),indices(2)) = {0};
else
app.UITable4.Data(indices(1),indices(2)) = {newData};
end
dia_eje = [app.UITable1.Data(1:app.EditField1.Value - 2,2)';app.UITable1.Data(2:app.EditField1.Value - 1,2)'];
dia_may = max(dia_eje);
dia_men = min(dia_eje);
rel_dia = dia_may./dia_men;
% dif_dia = [0, (dia_may - dia_men) / 2, 0];
app.UITable4.Data(find(rel_dia == 1) + 1,1) = {0};
app.UITable4.Data(find(rel_dia ~= 1) + 1,2:4) = {0};
% app.UITable4.Data(dif_dia < cell2mat(app.UITable4.Data(:,1))',1) = num2cell(dif_dia(dif_dia < cell2mat(app.UITable4.Data(:,1))'));
app.UITable4.Data(find(rel_dia ~= 1) + 1,5:6) = {'Ninguno'};
% exi_apo = ~(strcmp(app.UITable2.Data(1:app.EditField1.Value,1),'Ninguno')) & ~(strcmp(app.UITable2.Data(1:app.EditField1.Value,1),'Definir'));
% app.UITable4.Data(exi_apo,1:4) = {0};
% app.UITable4.Data(exi_apo,5:6) = {'Ninguno'};
if (indices(2) == 5 || indices(2) == 6)
j = zeros(1,app.EditField1.Value);
Nodos = {};
for i = 1:app.EditField1.Value
if sum(strcmp(app.UITable4.Data(i,[5,6]),'Ninguno')) ~= 2 && sum(strcmp(app.UITable4.Data(i,[5,6]),'Definir')) ~= 2
j(i) = i;
Nodos = horzcat(Nodos, {['Nodo ', num2str(i)]}); %#ok<AGROW>
end
end
app.UITable16.Data = zeros(length(nonzeros(j)), 5);
app.UITable16.RowName = Nodos;
app.UITable16.Data(:,3) = cell2mat(app.UITable2.Data(nonzeros(j), 5));
if isempty(app.UITable16.Data) ~= 1
d = max([app.UITable1.Data(:,2)', 0; 0, app.UITable1.Data(:,2)'])';
app.UITable16.Data(:,4) = d(nonzeros(j)) / 4;
end
end
close(bar_pro)
end
% Cell selection callback: UITable5
function UITable5CellSelection(app, event)
global L3 L4
try
indices = event.Indices;
x4 = [0 cumsum(app.UITable1.DisplayData(:,1))'];
L4.XData = [x4(indices(1)) x4(indices(1) + 1)];
L3.XData = [0 0];
L3.YData = [0 0];
catch
end
end
% Button pushed function: Button23
function Button23Pushed(app, event)
bar_pro = uiprogressdlg(app.UIFigure,'Title','Porfavor espere','Message','Iniciando Calculos','Indeterminate','on');
bar_pro.Message = 'Calculando factores de concentracion de esfuerzos estaticos';pause(2)
app.UITable4.Data(strcmp(app.UITable4.Data(:,5),'Definir'),5) = {'Ninguno'};
app.UITable4.Data(strcmp(app.UITable4.Data(:,6),'Definir'),6) = {'Ninguno'};
app.UITable4.Data(:,7:20) = {1};
r_fa1 = [1.01 1.02 1.05 1.07 1.1 1.15 1.2 1.3 1.5 2];
A_fa1 = [0.98 1.01 1 0.98 0.98 0.98 0.96 1 1 1.01];
b_fa1 = [-0.1 -0.12 -0.17 -0.2 -0.21 -0.22 -0.26 -0.26 -0.28 -0.3];
r_mf1 = [1.01 1.02 1.03 1.05 1.07 1.1 1.2 1.5 2 3 6];
A_mf1 = [0.92 0.96 0.98 0.98 0.98 0.95 0.97 0.94 0.91 0.89 0.88];
b_mf1 = [-0.17 -0.18 -0.18 -0.2 -0.21 -0.24 -0.22 -0.26 -0.29 -0.31 -0.33];
r_mt1 = [1.09 1.2 1.33 2];
A_mt1 = [0.9 0.83 0.85 0.86];
b_mt1 = [-0.13 -0.22 -0.23 -0.24];
r_fa2 = [1.01 1.02 1.03 1.05 1.07 1.1 1.15 1.2 1.3 1.5 2 4];
A_fa2 = [1 1.04 1.04 1.03 1.02 1.03 1.03 1.01 1 1 0.99 0.99];
b_fa2 = [-0.16 -0.19 -0.22 -0.25 -0.28 -0.29 -0.32 -0.34 -0.36 -0.37 -0.38 -0.39];
r_mf2 = [1.01 1.02 1.03 1.05 1.07 1.1 1.12 1.15 1.2 1.3 1.5 2 4];
A_mf2 = [0.99 0.98 0.99 0.99 0.97 0.95 0.96 0.95 0.95 0.94 0.94 0.94 0.95];
b_mf2 = [-0.15 -0.2 -0.22 -0.24 -0.26 -0.28 -0.29 -0.3 -0.31 -0.32 -0.32 -0.33 -0.33];
r_mt2 = [1.01 1.02 1.05 1.1 1.2 1.3 2 4];
A_mt2 = [0.97 0.97 0.94 0.92 0.9 0.89 0.89 0.88];
b_mt2 = [-0.1 -0.13 -0.17 -0.2 -0.22 -0.23 -0.24 -0.25];
r_fa3 = [0 0.05 0.1 0.15 0.2 0.25 0.3 0.35];
A_fa3 = [3 2.85 2.7 2.60 2.5 2.45 2.35 2.3];
r_mt3 = [0 0.05 0.1 0.15 0.2 0.25 0.3];
A_mt3 = [2 1.81 1.68 1.57 1.5 1.45 1.4];
dia_eje = [app.UITable1.Data(1:app.EditField1.Value - 2,2)';app.UITable1.Data(2:app.EditField1.Value - 1,2)'];
dia_may = max(dia_eje);
dia_men = min(dia_eje);
rel_dia = dia_may./dia_men;
A_fa1 = spline(r_fa1,A_fa1,rel_dia);
A_mf1 = spline(r_mf1,A_mf1,rel_dia);
A_mt1 = spline(r_mt1,A_mt1,rel_dia);
b_fa1 = spline(r_fa1,b_fa1,rel_dia);
b_mf1 = spline(r_mf1,b_mf1,rel_dia);
b_mt1 = spline(r_mt1,b_mt1,rel_dia);
Kt_a1 = [0 A_fa1 .* (cell2mat(app.UITable4.Data(2:app.EditField1.Value - 1,1))' ./ dia_men) .^ b_fa1 0];
Kt_f1 = [0 A_mf1 .* (cell2mat(app.UITable4.Data(2:app.EditField1.Value - 1,1))' ./ dia_men) .^ b_mf1 0];
Kt_t1 = [0 A_mt1 .* (cell2mat(app.UITable4.Data(2:app.EditField1.Value - 1,1))' ./ dia_men) .^ b_mt1 0];
app.UITable4.Data(logical([0 rel_dia ~= 1 0]),7) = num2cell(Kt_a1(logical([0 rel_dia ~= 1 0])));
app.UITable4.Data(logical([0 rel_dia ~= 1 0]),8) = num2cell(Kt_f1(logical([0 rel_dia ~= 1 0])));
app.UITable4.Data(logical([0 rel_dia ~= 1 0]),9) = num2cell(Kt_t1(logical([0 rel_dia ~= 1 0])));
ind_ca1 = cell2mat(app.UITable4.Data(:,2)) ~= 0 & cell2mat(app.UITable4.Data(:,3)) ~= 0;
ind_ca2 = ind_ca1;
ind_ca2(1) = [];
rel_dia = app.UITable1.Data(ind_ca2, 2) ./ cell2mat(app.UITable4.Data(ind_ca1, 3));
A_fa2 = spline(r_fa2,A_fa2,rel_dia);
A_mf2 = spline(r_mf2,A_mf2,rel_dia);
A_mt2 = spline(r_mt2,A_mt2,rel_dia);
b_fa2 = spline(r_fa2,b_fa2,rel_dia);
b_mf2 = spline(r_mf2,b_mf2,rel_dia);
b_mt2 = spline(r_mt2,b_mt2,rel_dia);
Kt_a2 = A_fa2 .* (cell2mat(app.UITable4.Data(ind_ca1, 2)) ./ cell2mat(app.UITable4.Data(ind_ca1, 3))) .^ b_fa2;
Kt_f2 = A_mf2 .* (cell2mat(app.UITable4.Data(ind_ca1, 2)) ./ cell2mat(app.UITable4.Data(ind_ca1, 3))) .^ b_mf2;
Kt_t2 = A_mt2 .* (cell2mat(app.UITable4.Data(ind_ca1, 2)) ./ cell2mat(app.UITable4.Data(ind_ca1, 3))) .^ b_mt2;
app.UITable4.Data(ind_ca1,10) = num2cell(Kt_a2);
app.UITable4.Data(ind_ca1,11) = num2cell(Kt_f2);
app.UITable4.Data(ind_ca1,12) = num2cell(Kt_t2);
ind_ca1 = cell2mat(app.UITable4.Data(:,4)) ~= 0;
ind_ca2 = ind_ca1;
ind_ca2(1) = [];
rel_dia = cell2mat(app.UITable4.Data(ind_ca1, 4)) ./ app.UITable1.Data(ind_ca2, 2);
Kt_a3 = spline(r_fa3,A_fa3,rel_dia);
Kt_f3 = 1.59 - 0.64.*log10(rel_dia);
Kt_t3 = spline(r_mt3,A_mt3,rel_dia);
app.UITable4.Data(ind_ca1, 13) = num2cell(Kt_a3);
app.UITable4.Data(ind_ca1, 14) = num2cell(Kt_f3);
app.UITable4.Data(ind_ca1, 15) = num2cell(Kt_t3);
Kt_ft = zeros(app.EditField1.Value,3);
r_fa4 = [1.9 1.6 1.3; 1.3 1.3 1.3; 2.4 2 1.6; 1.6 1.6 1.6];
for i = 1:app.EditField1.Value
Rec_Rev = app.UITable4.Data(i,[5,6]);
if sum(strcmp(Rec_Rev,'Ninguno')) == 2
Kt_ft(i,:) = [1 1 1];
else
switch char(Rec_Rev(~strcmp(Rec_Rev,'Ninguno')))
case 'Recocido'
if find(~strcmp(Rec_Rev,'Ninguno') == 1) == 1
Kt_ft(i,:) = r_fa4(1,:);
else
Kt_ft(i,:) = r_fa4(2,:);
end
case 'Revenido'
if find(~strcmp(Rec_Rev,'Ninguno') == 1) == 1
Kt_ft(i,:) = r_fa4(3,:);
else
Kt_ft(i,:) = r_fa4(4,:);
end
end
end
end
app.UITable4.Data(:,16:18) = num2cell(Kt_ft);
% Se actualizan los factores si el tramo es hueco
dfac = app.UITable4.Data(:,7:18);
dint = app.UITable1.Data(:,3);
nax = [1, 4, 7, 10];
nfl = [2, 5, 8, 11];
for i = 1:size(dfac, 1)
for j = 1:size(dfac, 2)
if dfac{i, j} ~= 1
if i == 1
if dint(i) ~= 0
if ismember(j, nax)
dfac{i, j} = dfac{i, j} * randi([110 130], 1, 1) / 100;
elseif ismember(j, nfl)
dfac{i, j} = dfac{i, j} * randi([120 150], 1, 1) / 100;
else
dfac{i, j} = dfac{i, j} * randi([130 170], 1, 1) / 100;
end
end
elseif i == size(dfac, 1)
if dint(i - 1) ~= 0
if ismember(j, nax)
dfac{i, j} = dfac{i, j} * randi([110 130], 1, 1) / 100;
elseif ismember(j, nfl)
dfac{i, j} = dfac{i, j} * randi([120 150], 1, 1) / 100;
else
dfac{i, j} = dfac{i, j} * randi([130 170], 1, 1) / 100;
end
end
else
if dint(i) ~= 0 || dint(i - 1) ~= 0
if ismember(j, nax)
dfac{i, j} = dfac{i, j} * randi([110 130], 1, 1) / 100;
elseif ismember(j, nfl)
dfac{i, j} = dfac{i, j} * randi([120 150], 1, 1) / 100;
else
dfac{i, j} = dfac{i, j} * randi([130 170], 1, 1) / 100;
end
end
end
end
end
end
app.UITable4.Data(:,7:18) = dfac;
bar_pro.Message = 'Calculando factores que modifican el limite de fatiga';pause(2)
app.UITable5.Data(strcmp(app.UITable5.Data(:,1),'Definir')) = {'Ninguno'};
k1 = zeros(app.EditField1.Value - 1,1);
k2 = zeros(app.EditField1.Value - 1,1);
k3 = zeros(app.EditField1.Value - 1,1);
k4 = zeros(app.EditField1.Value - 1,1);
for i = 1:app.EditField1.Value - 1
switch char(app.UITable5.Data(i, 1))
case 'Ninguno'
a = 1;
b = 0;
case 'Esmerilado'
a = 1.58;
b = -0.085;
case 'Maquinado'
a = 4.51;
b = -0.265;
case 'Rolado en Caliente'
a = 57.7;
b = -0.718;
case 'Rolado en Frio'
a = 4.51;
b = -0.265;
case 'Forjado'
a = 272;
b = -0.995;
end
k1(i,1) = a * (app.UITable1.Data(i,9) / 1e6) ^ b;
if app.UITable1.Data(i, 2) <= 51e-3
k2(i,1) = 1.24 * (app.UITable1.Data(i, 2) * 1000) ^ -0.107;
else
k2(i,1) = 1.51 * (app.UITable1.Data(i, 2) * 1000) ^ -0.157;
end
k3(i,1) = randi([85 100],1) / 100;
if app.EditField24.Value <= 450
k4(i,1) = 1;
else
k4(i,1) = 1 - 0.0058 * (app.EditField24.Value - 450);
end
if app.UITable1.Data(i,9) <= 1400e6
app.UITable5.Data(i,7) = {0.5 * app.UITable1.Data(i,9)};
else
app.UITable5.Data(i,7) = {700e6};
end
end
k1(k1 > 1 | k1 == 0) = 1;
k2(k2 > 1 | k2 == 0) = 1;
app.UITable5.Data(:,2) = num2cell(k1);
app.UITable5.Data(:,3) = num2cell(k2);
app.UITable5.Data(:,4) = num2cell(k3);
app.UITable5.Data(:,5) = num2cell(k4);
xdata = [50.0000, 90.0000, 95.0000, 99.0000, 99.9000, 99.9900, 99.9990, 99.9999, 100];
ydata = [1.0000, 0.8970, 0.8680, 0.8140, 0.7530, 0.7020, 0.6590, 0.6200, 0.6];
for i = 1:length(xdata) - 1
if app.EditField25.Value >= xdata(i) && app.EditField25.Value <= xdata(i + 1)
lef = i;
rig = i + 1;
app.UITable5.Data(:,6) = {interp1(xdata([lef, rig]), ydata([lef, rig]), app.EditField25.Value, "linear")};
break
end
end
% app.UITable5.Data(:,6) = {spline([50 90 95 99 99.9 99.99 99.999 99.9999], [1 0.897 0.868 0.814 0.753 0.702 0.659 0.62], app.EditField25.Value)};
app.UITable5.Data(:,8) = num2cell(k1 .* k2 .* k3 .* k4 .* cell2mat(app.UITable5.Data(:,6)) .* cell2mat(app.UITable5.Data(:,7)));
bar_pro.Message = 'Calculando factores de concentracion de esfuerzos dinamicos';pause(2)
fac_con = zeros(app.EditField1.Value,3);
for i = 1:app.EditField1.Value
if length(app.UITable4.Data(i, find(cell2mat(app.UITable4.Data(i,7:18)) ~= 1) + 6)) == 3
fac_con(i,:) = cell2mat(app.UITable4.Data(i, find(cell2mat(app.UITable4.Data(i,7:18)) ~= 1) + 6));
else
fac_con(i,:) = 1;
end
end
Su = min([app.UITable1.Data(:,9)' 0; 0 app.UITable1.Data(:,9)']);
raa_foa = (0.246 - 3.08e-3 * (Su * 1.45e-7) + 1.51e-5 * (Su * 1.45e-7).^2 - 2.67e-8 * (Su * 1.45e-7).^3) * sqrt(25.4);
raa_cot = (0.190 - 2.51e-3 * (Su * 1.45e-7) + 1.35e-5 * (Su * 1.45e-7).^2 - 2.67e-8 * (Su * 1.45e-7).^3) * sqrt(25.4);
q_foa = 1 ./ (1 + raa_foa(cell2mat(app.UITable4.Data(:,1)) ~= 0)' ./ sqrt(cell2mat(app.UITable4.Data(cell2mat(app.UITable4.Data(:,1)) ~= 0, 1)) * 1000));
q_cot = 1 ./ (1 + raa_cot(cell2mat(app.UITable4.Data(:,1)) ~= 0)' ./ sqrt(cell2mat(app.UITable4.Data(cell2mat(app.UITable4.Data(:,1)) ~= 0, 1)) * 1000));
kf_foa = 1 + q_foa .* (fac_con(cell2mat(app.UITable4.Data(:,1)) ~= 0, 2) - 1);
kf_cot = 1 + q_cot .* (fac_con(cell2mat(app.UITable4.Data(:,1)) ~= 0, 3) - 1);
kf_fya = ones(app.EditField1.Value, 1); kf_fya(cell2mat(app.UITable4.Data(:,1)) ~= 0, 1) = kf_foa;
kf_cyt = ones(app.EditField1.Value, 1); kf_cyt(cell2mat(app.UITable4.Data(:,1)) ~= 0, 1) = kf_cot;
app.UITable4.Data(:,19) = num2cell(kf_fya);
app.UITable4.Data(:,20) = num2cell(kf_cyt);
if sum(app.UITable1.Data(:,1)) / mean(app.UITable1.Data(:,2) - app.UITable1.Data(:,3)) <= 10
app.Button22.FontWeight = 'bold';
app.Button1.FontWeight = 'normal';
else
app.Button1.FontWeight = 'bold';
app.Button22.FontWeight = 'normal';
end
if isempty(app.UITable16.Data) ~= 1
app.UITable16.Data(:,5) = app.UITable16.Data(:,3) ./ ((app.UITable16.Data(:,1) ./ app.UITable16.Data(:,2)) .* app.UITable16.Data(:,4) .^ 2);
end
close(bar_pro)
end
% Button pushed function: Button1
function Button1Pushed(app, event)
global bernotimo X_dom Ecu_Cor Ecu_Mom Ecu_Pen Ecu_Def V_zyy M_zyy Esf_Nom4 Cor_Nom4 Fue_Axi Esf_Axi Tor_Nod Esf_Tor Def_Rea Pen_Rea Vonmises Tresca Rankine Esf_Sod Esf_God Esf_Asm FS_Vonm FS_Tres FS_Rank Fsf_Sod Fsf_God Fsf_Asm Vel_Dun Vel_Ray D_rea Des_z Des_y
bar_pro = uiprogressdlg(app.UIFigure,'Title','Porfavor espere','Message','Iniciando Calculos','Indeterminate','on');
app.UITable2.Data(strcmp(app.UITable2.Data(:,1),'Definir'),1) = {'Ninguno'};
bernotimo = 1;
cla(app.UIAxes8)
cla(app.UIAxes9)
cla(app.UIAxes11)
cla(app.UIAxes16)
app.UITable1.Data(:,11) = 1;
syms x x1
bar_pro.Message = 'Recopilando datos del eje';pause(2)
Tip_Apo = zeros(3, app.EditField1.Value);
for i = 1:app.EditField1.Value
switch app.UITable2.Data{i,1}
case 'Simple'
Tip_Apo(1:3, i) = [i 0 0]';
case 'Elastico'
Tip_Apo(1:3, i) = [0 i 0]';
case 'Fijo'
Tip_Apo(1:3, i) = [0 0 i]';
case 'Ninguno'
Tip_Apo(1:3, i) = [0 0 0]';
end
end
Nod_Fin = (cumsum(app.UITable1.DisplayData(:,1)))';
Nod_Ini = (Nod_Fin' - app.UITable1.DisplayData(:,1))';
Apo_Sim = Tip_Apo(1,:);
Apo_Ela = Tip_Apo(2,:);
Apo_Fij = Tip_Apo(3,:);
Dia_Eje = app.UITable1.Data(:,2)';
Dia_eje = app.UITable1.Data(:,3)';
Mod_You = app.UITable1.Data(:,6)';
Mod_Cor = app.UITable1.Data(:,7)';
Esf_Flu = app.UITable1.Data(:,8);
Mom_Izy = (pi / 64) * (Dia_Eje .^ 4 - Dia_eje .^ 4);
Mom_Pol = 2 * Mom_Izy;
Are_Sec = (pi / 4) * (Dia_Eje .^ 2 - Dia_eje .^ 2);
Cen_y = Dia_Eje / 2;
Q_Itzy = (4 * ((Dia_Eje / 2) .^ 2 + (Dia_Eje / 2) .* (Dia_eje / 2) + (Dia_eje / 2) .^ 2)) ./ (3 * pi * ((Dia_Eje / 2) .^ 4 - (Dia_eje / 2) .^ 4));
C_Izy = (Dia_Eje / 2) ./ Mom_Izy;
Izy_You = Mom_Izy .* Mod_You;
Ine_You = [Izy_You; Izy_You];
Fue_DisY = app.UITable1.Data(:,5)';
Fue_DisZ = app.UITable1.Data(:,4)';
Fue_Axi = cell2sym(app.UITable2.Data(:,2));
Fue_NodY = cell2sym(app.UITable2.Data(:,3));
Fue_NodZ = cell2sym(app.UITable2.Data(:,4));
Tor_Nod = cell2sym(app.UITable2.Data(:,5));
Mom_NodY = cell2sym(app.UITable2.Data(:,6));
Mom_NodZ = cell2sym(app.UITable2.Data(:,7));
Fue_Nod = [Fue_NodZ Fue_NodY];
Mom_Nod = [Mom_NodY Mom_NodZ];
Fue_Dis = [Fue_DisZ;Fue_DisY];
bar_pro.Message = 'Calculando componentes axiales';pause(2)
Apo_EF = nonzeros(Apo_Ela + Apo_Fij)';
Rea_Axi = cell2sym({zeros(length(Nod_Fin)+1,1)});
if isempty(Apo_EF) == 1
Fue_Axi = cumsum(Fue_Axi(1:length(Nod_Fin)));
Esf_Axi = Fue_Axi./Are_Sec';
Des_Axi = double((Fue_Axi.*(Nod_Fin-Nod_Ini)')./(Mod_You.*Are_Sec)');
Des_Axi(app.EditField1.Value) = (sum(cell2mat(app.UITable2.Data(:,2))) * (Nod_Fin(app.EditField1.Value - 1) - Nod_Ini(app.EditField1.Value - 1))) ./ (Mod_You(app.EditField1.Value - 1) * Are_Sec(app.EditField1.Value - 1));
else
Cons_6 = sym('n', [1 length(Apo_EF)]);
Rea_Axi(Apo_EF) = Cons_6;
Sum_Axi = Rea_Axi + Fue_Axi;
Fue_Axi = cumsum(Sum_Axi(1:length(Nod_Fin)));
if length(Apo_EF) == 1
Sis_Axi = sum(Sum_Axi);
Res_Axi = solve(Sis_Axi);
Res_Axi = double(Res_Axi);
else
Com_Axi = (Fue_Axi.*(Nod_Fin-Nod_Ini)')./(Mod_You.*Are_Sec)';
Ecu_Axi = cell2sym({zeros(1,length(Apo_EF) - 1)});
for i = 1:length(Apo_EF) - 1
Ecu_Axi(i) = sum(Com_Axi(Apo_EF(i):Apo_EF(i+1)-1));
end
Sis_Axi = [sum(Sum_Axi) Ecu_Axi];
Res_Axi = solve(Sis_Axi);
Res_Axi = struct2cell(Res_Axi);
Res_Axi = cell2sym(Res_Axi);
Res_Axi = double(Res_Axi);
end
for i = 1:length(Nod_Fin)
for j = 1:length(Apo_EF)
Fue_Axi(i) = subs(Fue_Axi(i),{Cons_6(j)},{Res_Axi(j)});
end
end
for i = 1:length(Nod_Fin)+1
for j = 1:length(Apo_EF)
Rea_Axi(i) = subs(Rea_Axi(i),{Cons_6(j)},{Res_Axi(j)});
end
end
Esf_Axi = Fue_Axi./Are_Sec';
Des_Axi = double((Fue_Axi.*(Nod_Fin-Nod_Ini)')./(Mod_You.*Are_Sec)');
Des_Axi(app.EditField1.Value) = (sum(cell2mat(app.UITable2.Data(:,2)) + double(Rea_Axi)) * (Nod_Fin(app.EditField1.Value - 1) - Nod_Ini(app.EditField1.Value - 1))) ./ (Mod_You(app.EditField1.Value - 1) * Are_Sec(app.EditField1.Value - 1));
end
bar_pro.Message = 'Calculando componentes torsionales';pause(2)
Apo_F = nonzeros(Apo_Fij)';
Rea_Tor = cell2sym({zeros(length(Nod_Fin)+1,1)});
if isempty(Apo_F) == 1
Tor_Nod = cumsum(Tor_Nod(1:length(Nod_Fin)));
Esf_Tor = (Tor_Nod.*Cen_y')./Mom_Pol';
Des_Tor = double((Tor_Nod.*(Nod_Fin-Nod_Ini)')./(Mod_You.*Are_Sec)');
Des_Tor(app.EditField1.Value) = (sum(cell2mat(app.UITable2.Data(:,5))) * (Nod_Fin(app.EditField1.Value - 1) - Nod_Ini(app.EditField1.Value - 1))) ./ (Mod_Cor(app.EditField1.Value - 1) * Mom_Pol(app.EditField1.Value - 1));
else
Cons_7 = sym('m', [1 length(Apo_F)]);
Rea_Tor(Apo_F) = Cons_7;
Sum_Tor = Rea_Tor + Tor_Nod;
Tor_Nod = cumsum(Sum_Tor(1:length(Nod_Fin)));
if length(Apo_F) == 1
Sis_Tor = sum(Sum_Tor);
Res_Tor = solve(Sis_Tor);
Res_Tor = double(Res_Tor);
else
Com_Tor = (Tor_Nod.*(Nod_Fin-Nod_Ini)')./(Mod_Cor.*Mom_Pol)';
Ecu_Tor = cell2sym({zeros(1,length(Apo_F) - 1)});
for i = 1:length(Apo_F) - 1
Ecu_Tor(i) = sum(Com_Tor(Apo_F(i):Apo_F(i+1)-1));
end
Sis_Tor = [sum(Sum_Tor) Ecu_Tor];
Res_Tor = solve(Sis_Tor);
Res_Tor = struct2cell(Res_Tor);
Res_Tor = cell2sym(Res_Tor);
Res_Tor = double(Res_Tor);
end
for i = 1:length(Nod_Fin)
for j = 1:length(Apo_F)
Tor_Nod(i) = subs(Tor_Nod(i),{Cons_7(j)},{Res_Tor(j)});
end
end
for i = 1:length(Nod_Fin)+1
for j = 1:length(Apo_F)
Rea_Tor(i) = subs(Rea_Tor(i),{Cons_7(j)},{Res_Tor(j)});
end
end
Esf_Tor = (Tor_Nod.*Cen_y')./Mom_Pol';
Des_Tor = double((Tor_Nod.*(Nod_Fin-Nod_Ini)')./(Mod_You.*Are_Sec)');
Des_Tor(app.EditField1.Value) = (sum(cell2mat(app.UITable2.Data(:,5)) + double(Rea_Tor)) * (Nod_Fin(app.EditField1.Value - 1) - Nod_Ini(app.EditField1.Value - 1))) ./ (Mod_Cor(app.EditField1.Value - 1) * Mom_Pol(app.EditField1.Value - 1));
end
bar_pro.Message = 'Calculando componentes cortantes y flexionantes';pause(2)
Ecu_Def = cell2sym({zeros(length(Nod_Fin), 2)});
Rea_FYZ = cell2sym({zeros(length(Nod_Fin)+1, 2)});
for j = 1:2
Apo_Tot = Apo_Sim + Apo_Ela + Apo_Fij;
Cons_0 = sym('r', [1 length(find(Apo_Tot ~= 0))]);
Rea_Fue = cell2sym({zeros(length(Nod_Fin)+1,1)});
Rea_Fue(Apo_Tot ~= 0) = Cons_0;
Fue_Nod(:,j) = Fue_Nod(:,j) + Rea_Fue;
if isempty(find(Apo_Fij ~= 0, 1)) == 0
Cons_1 = sym('m', [1 length(find(Apo_Fij ~= 0))]);
Rea_Mom = cell2sym({zeros(length(Nod_Fin)+1,1)});
Rea_Mom(Apo_Fij ~= 0) = Cons_1;
Mom_Nod(:,j) = Mom_Nod(:,j) + Rea_Mom;
end
Com_Fue = cell2sym({zeros(1,length(Nod_Fin))});
Com_Dis = cell2sym({zeros(1,length(Nod_Fin))});
for i = 1:length(Nod_Fin)
Com_Fue(i) = sum(Fue_Nod(1:i,j));
Com_Dis(i) = Fue_Dis(j,i)*(x-Nod_Ini(i));
end
Fue_Equ = Fue_Dis(j,:).*(Nod_Fin-Nod_Ini);
Fue_Equ = cumsum(Fue_Equ);
Fue_Equ = [0 Fue_Equ(1:length(Fue_Equ)-1)];
Ecu_Cor = cell2sym({zeros(length(Nod_Fin), 1)});
for i = 1:length(Nod_Fin)
Ecu_Cor(i,1) = Com_Fue(i) + Com_Dis(i) + Fue_Equ(i);
end
Cons_2 = sym('a', [1 length(Nod_Fin) ]);
x1 = 0;
Ecu_Mom = cell2sym({zeros(length(Nod_Fin), 1)});
for i = 1:length(Nod_Fin)
Ecu_1 = int(Ecu_Cor(i),'x') + Cons_2(i) + Mom_Nod(i,j) - x1;
Ecu_1 = subs(Ecu_1,'x',Nod_Ini(i));
Cons_2(i) = solve(Ecu_1,Cons_2(i));
Ecu_Mom(i,1) = int(Ecu_Cor(i),'x') + Cons_2(i);
x1 = subs(Ecu_Mom(i),'x',Nod_Fin(i));
end
Sis_Fue = sum(Fue_Nod(:,j)) + sum(Fue_Dis(j,:).*(Nod_Fin-Nod_Ini));
Sis_Mom = sum(Mom_Nod(:,j)) + sum(Nod_Fin'.*Fue_Nod(2:length(Fue_Nod),j)) + sum((Fue_Dis(j,:).*(Nod_Fin-Nod_Ini)).*((Nod_Fin+Nod_Ini)./2));
Ecu_Pen = cell2sym({zeros(length(Nod_Fin), 1)});
for i = 1:length(Nod_Fin)
Ecu_Pen(i,1) = int(Ecu_Mom(i),'x') + str2sym(['c',num2str(2*i-1)]);
Ecu_Def(i,j) = int(Ecu_Pen(i),'x') + str2sym(['c',num2str(2*i)]);
end
Sis_Pen = cell2sym({zeros(1, length(Nod_Fin) - 1)});
Sis_Def = cell2sym({zeros(1, length(Nod_Fin) - 1)});
for i = 1:length(Nod_Fin)-1
Sis_Pen(i) = subs(Ecu_Pen(i+1),'x',Nod_Fin(i))./Ine_You(j,i+1)-subs(Ecu_Pen(i),'x',Nod_Fin(i))./Ine_You(j,i);
Sis_Def(i) = subs(Ecu_Def(i+1,j),'x',Nod_Fin(i))./Ine_You(j,i+1)-subs(Ecu_Def(i,j),'x',Nod_Fin(i))./Ine_You(j,i);
end
Apo_Tot = nonzeros(Apo_Tot)';
Apo_fij = nonzeros(Apo_Fij)';
Con_1 = 0;
Con_2 = 0;
Nod_Tot = [0 Nod_Fin];
Sis_Nod = cell2sym({zeros(1,length(Apo_Tot))});
for i = Apo_Tot
Con_1 = Con_1 + 1;
if i ~= length(Nod_Fin)+1
Sis_Nod(Con_1) = subs(Ecu_Def(i,j),'x',Nod_Tot(i));
else
Sis_Nod(Con_1) = subs(Ecu_Def(i-1,j),'x',Nod_Tot(i));
end
end
Sis_Nop = cell2sym({zeros(1,length(Apo_fij))});
if length(Nod_Fin) ~= 1
if isempty(find(Apo_fij ~= 0, 1)) == 0
for i = Apo_fij
Con_2 = Con_2 + 1;
if i ~= length(Nod_Fin)+1
Sis_Nop(Con_2) = subs(Ecu_Pen(i),'x',Nod_Tot(i));
else
Sis_Nop(Con_2) = subs(Ecu_Pen(i-1),'x',Nod_Tot(i));
end
end
Sis_Ecu = [Sis_Fue Sis_Mom Sis_Pen Sis_Def Sis_Nop Sis_Nod];
else
Sis_Ecu = [Sis_Fue Sis_Mom Sis_Pen Sis_Def Sis_Nod];
end
else
if isempty(find(Apo_fij ~= 0, 1)) == 0
for i = Apo_fij
Con_2 = Con_2 + 1;
if i ~= length(Nod_Fin)+1
Sis_Nop(Con_2) = subs(Ecu_Pen(i),'x',Nod_Tot(i));
else
Sis_Nop(Con_2) = subs(Ecu_Pen(i-1),'x',Nod_Tot(i));
end
end
Sis_Ecu = [Sis_Fue Sis_Mom Sis_Nop Sis_Nod];
else
Sis_Ecu = [Sis_Fue Sis_Mom Sis_Nod];
end
end
bar_pro.Message = 'Resolviendo sistema de ecuaciones';pause(2)
Res_Sis = solve(Sis_Ecu);
Res_Sis = struct2cell(Res_Sis);
Res_Sis = cell2sym(Res_Sis);
Res_Sis = double(Res_Sis);
Cons_3 = sym('c', [1 2*length(Nod_Fin)]);
Cons_4 = sym('m', [1 length(Apo_Tot)]);
Cons_5 = sym('r', [1 length(Apo_Tot)]);
if isempty(Apo_fij) == 1
for i = 1:length(Nod_Fin)+1
for k = 1:length(Apo_Tot)
Rea_Fue(i) = subs(Rea_Fue(i),{Cons_5(k)},Res_Sis(2*length(Nod_Fin)+k));
end
Rea_FYZ(i,j) = Rea_Fue(i);
end
Rea_MYZ = zeros(length(Nod_Fin)+1,2);
else
for i = 1:length(Nod_Fin)+1
for k = 1:length(Apo_Tot)
Rea_Fue(i) = subs(Rea_Fue(i),{Cons_5(k)},Res_Sis(2*length(Nod_Fin)+length(Apo_fij)+k));
end
Rea_FYZ(i,j) = Rea_Fue(i);
for k = 1:length(Apo_fij)
Rea_Mom(i) = subs(Rea_Mom(i),{Cons_4(k)},Res_Sis(2*length(Nod_Fin)+k));
end
Rea_MYZ(i,j) = Rea_Mom(i);
end
end
if isempty(find(Apo_fij ~= 0, 1)) == 0
for i = 1:length(Nod_Fin)
Ecu_Def(i,j) = subs(Ecu_Def(i,j),{Cons_3(2*i-1),Cons_3(2*i)},{Res_Sis(2*i-1),Res_Sis(2*i)});
for k = 1:length(Apo_Tot)
Ecu_Def(i,j) = subs(Ecu_Def(i,j),{Cons_4(k),Cons_5(k)},{Res_Sis(2*length(Nod_Fin)+k),Res_Sis(2*length(Nod_Fin)+length(Apo_fij)+k)});
end
end
else
for i = 1:length(Nod_Fin)
Ecu_Def(i,j) = subs(Ecu_Def(i,j),{Cons_3(2*i-1),Cons_3(2*i)},{Res_Sis(2*i-1),Res_Sis(2*i)});
for k = 1:length(Apo_Tot)
Ecu_Def(i,j) = subs(Ecu_Def(i,j),{Cons_5(k)},{Res_Sis(2*length(Nod_Fin)+k)});
end
end
end
end
Ecu_Def = Ecu_Def./Ine_You';
Ecu_Pen = diff(Ecu_Def,'x');
Ecu_Mom = diff(Ecu_Pen,'x').*Ine_You';
Ecu_Cor = diff(Ecu_Mom,'x');
Def_Rea = sqrt(Ecu_Def(:,1).^2 + Ecu_Def(:,2).^2);
Pen_Rea = sqrt(Ecu_Pen(:,1).^2 + Ecu_Pen(:,2).^2);
X_dom = zeros(1,sum(app.UITable1.Data(:,11) + 12 + 2));
D_rea = zeros(1,sum(app.UITable1.Data(:,11) + 12 + 2));
Des_z = zeros(1,sum(app.UITable1.Data(:,11) + 12 + 2));
Des_y = zeros(1,sum(app.UITable1.Data(:,11) + 12 + 2));