Slope and Deflection SOLVING USING MATLAB Mahmoud Nasr - 201301357| Mechanics of Materials | December 16, 2015 Problem Statement: This computer problem require writing a code that solves a general cantilever beam. The moment, slope and deflection at every point are to be found using a code that solves for any number of external concentrated forces. Approach: A wise way of solving this problem would be approaching it as we would approach if we were to solve it analytically, using ‘singularity’. Not only does it help us express the piece wise function as a single function, but also it makes the integration of the function much easier. However, MATLAB does not contain a ready-for-use singularity function. On the bright side though, MATLAB does include a ‘Heaviside’ function. This function behaves as follows: 0 𝑓𝑜𝑟 𝑥 < 𝑎 Let ℎ𝑒𝑎𝑣𝑖𝑠𝑖𝑑𝑒(𝑥 − 𝑎) = 0.5 𝑓𝑜𝑟 𝑥 = 𝑎 1 𝑓𝑜𝑟 𝑥 > 𝑎 If we are to take advantage of that function, we can easily create a general code which nearly completely mimics the singularity function. Steps: 1234- The properties of the beam were obtained by means of a user input. The external forces and their positions were also entered by the user. The reaction and moment at the support were calculated using statics. A matrix was formulated in symbolic form with (x-a) for all external forces where ‘a’ is the point of action of the force. (named –pos-) 5- The [pos] matrix was used to create the Heaviside function throughout. 6- Built-in symbolic integrals were used to find general form of the functions. 7- Values were substituted into functions and plots for slope and deflection were drawn. PAGE 1 Advantages of Code: 1- Contains ZERO loops so it is fast. 2- Only dot product was used in manipulating matrices therefore making it less computationally difficult. 3- Generic for any Cantilever beam with arbitrary number of external forces. Screenshots of Program: Figure 1: Beam Physical Properties Input Figure 2: Other User input (Forces, positions and increment) PAGE 2 Figure 3: Plot of Output Specific output required: Figure 4: Slope and Deflection at points B and C in required question PAGE 3