MATLAB Examples

# Matlab_Abaqus_10_Bar_Truss

Find the cross-sections of the members of the 10-bar truss so that its weight is minimized and the constraints are satisfied. For more information please see the Documentation of Matlab_Abaqus_10_Bar_Truss package.

## Run the optimization procedure

Set the variable NumElements as global, in order to be read by the other external functions of the package.

```global NumElements ```

Specify the number of elements of the truss.

```NumElements=10; ```

Make a starting guess for the solution.

```x0 = [30.9810; 0.1; 23.1714; 15.6935; 0.1; 0.5848; 7.4298; 20.6310; 21.3287; 0.1]; ```

Set the lower and upper limit of the cross section areas of the ten members of the truss.

```AreaMin=0.1; AreaMax=35; lb=AreaMin*ones(1,10); ub=AreaMax*ones(1,10); ```

Initialize timer.

```tic ```

Perform the optimization of the truss (constrained optimization with fmincon).

```[X,fval,exitflag,output,lambda] = fmincon(@Truss10objfun,x0,[],[],[],[], lb ,ub,'Truss10confun') ```
```Warning: The default trust-region-reflective algorithm does not solve problems with the constraints you have specified. FMINCON will use the active-set algorithm instead. For information on applicable algorithms, see Choosing the Algorithm in the documentation. Warning: Your current settings will run a different algorithm (interior-point) in a future release. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File not found or permission denied Warning: File not found or permission denied Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Warning: File 'Truss10ABAQUS.prt' not found. Local minimum possible. Constraints satisfied. fmincon stopped because the predicted change in the objective function is less than the default value of the function tolerance and constraints are satisfied to within the default value of the constraint tolerance. Active inequalities (to within options.TolCon = 1e-06): lower upper ineqlin ineqnonlin 2 5 5 11 10 X = 30.5218 0.1000 23.1999 15.2229 0.1000 0.5514 7.4572 21.0364 21.5284 0.1000 fval = 5.0609e+03 exitflag = 5 output = iterations: 24 funcCount: 347 lssteplength: 1 stepsize: 1.7894e-05 algorithm: 'medium-scale: SQP, Quasi-Newton, line-search' firstorderopt: 7.0552e-04 constrviolation: 1.1706e-09 message: [1x772 char] lambda = lower: [10x1 double] upper: [10x1 double] eqlin: [0x1 double] eqnonlin: [0x1 double] ineqlin: [0x1 double] ineqnonlin: [24x1 double] ```

Report elapsed time.

```toc ```
```Elapsed time is 5057.638942 seconds. ```
```____________________________________________________
Copyright (c) 2016 by George Papazafeiropoulos
Captain, Infrastructure Engineer, Hellenic Air Force
Civil Engineer, M.Sc., Ph.D. candidate, NTUA
Email: gpapazafeiropoulos@yahoo.gr
Website: http://users.ntua.gr/gpapazaf/```