 # Beam modal analysis using ANSYS APDL

Hey all, Welcome to Geeksforjobs

In this blog, we will learn to detect the natural frequency of cantilever beam using Ansys as well as Matlab code.

Example: Obtain a natural frequency of a steel bar with a length of 0.45 m. The width and height of the beam are 0.02 m and 0.003 m. The modulus of elasticity of a steel beam is 2.1 * 10 ^ 11 N / m ^ 2. Verify this with Ansys software and Matlab code with analytical solutions.

## Initial setting beam

Step1: Preferences> Structural

Step2: Preprocessor> Element Type> Add> Beam> 2 noded 188> OK

Step 3: Preprocessor> Physical Properties> Physical Model> Structural> Elastic> Isotropic> 2.1e11> Fine> Density> 7850> Fine> Close

Step4: Preprocessor> modeling> create> keypoint> active cs> key point number-1, location-0> apply >> keypoint number-2, location-0.45> ok

Step5: Preprocessor> modeling> create> line> active coordinate system> OK

Step6: Preprocessor> section> beam> common section> b = 0.02, h = 0.003> OK

Step7: Preprocessor> Meshing> Mesh Tool> Mesh 5> Element Element> OK

Step 8: Preprocessor> Load> Defined load> Structural> Select active point 1> Select all dof> OK

## Finding solutions

Step9: Solutions> Analysis Type> New Analysis> Modal

Step10: Solution> Analysis Options> Number of nodes to be removed = 3> OK

Step 11: Solution> Solution> Current LS> OK

Step12: General Postprocessing> Result Summary

.Step 13: General Postprocessor> Plot Results> Distorted Shape

Step 14: General Postprocessor> Plot Results> Contour Plotting> Nodal Solution

## Matlab code for cantilever beam

CLC;
den = input (‘Enter density’); % Density value
E = input (‘enter e’); % modulus of elasticity
B = input (‘enter b’); % Width
D = input (‘Enter d’); % Depth
l = input (‘Enter L’); % Length
I = BD ^ 3/12; % Inertia A = bd; % Area
f1 = sqrt ((ei) / (denAl ^ 4)); w1 = ((1.87 ^ 2) f1);
W 2 = ((4,694 ^ 2) f 1); w1 = w1 / (23.142);
W2 = w2 / (2 * 3.142);
fprintf (‘First frequency of cantilever beam =% f’, w1);
fprintf (‘Second frequency of cantilever beam =% f’, w2);
enter% b0.02
Enter% d0.003
Enter% L0.45
%
% First frequency of cantilever beam = 12.309133
% Second frequency of cantilever beam = 77.558681 >>

## Conclusion:

The error was 0.001%.