When we are designing a shaft or beam, we generally use moment and shear force diagrams to determine the critical points. There are several methods to draw a S&M Diagram. You can use commercial softwares like Mdsolids or you can draw by hand. I believe that we must use available technologies to solve our problems fastly. Matlab provides us simple and efficent solutions for this kind of problems.

We will use singularity function to draw S&M diagram. You can find more information about Singulariy Functions from the link below.

https://en.wikipedia.org/wiki/Singularity_function

I found this problem from mathalino.com. We will draw the S&M diagram of this problem in matlab. As I said before, we’ll use singularity function method. Simply we will define two functions V(x) and M(x). The location and direction of the forces are important in defining a singularity function.

The equations in the figure are same for metric unit. Let’s solve the problem.

V=-30*(x>0)+56*(x>1)-50*(x>4)+24*(x>6);

M=-30*(x>0).*(x-0)+56*(x>1).*(x-1)-50*(x>4).*(x-4)+24*(x>6).*(x-6);

For this problem, moment and shear force functions can be defined like that. The last step is iterating these functions. You can use linspace() function for the iteration. This function generates linearly spaced points.

x=linspace(0,6,10000);

v=-30*(x>0)+56*(x>1)-50*(x>4)+24*(x>7);

m=-30*(x>0).*(x-0)+56*(x>1).*(x-1)-50*(x>4).*(x-4)+24*(x>7).*(x-7);

subplot(211);

area(x,v);

subplot(212);

area(x,m);

Results:

Finally, this method are applicable for other programming languages like Python and Octave. I hope this article makes your life easier.

Have a science day.

Gokberk OZCICEK

*Referances:*

*http://www.public.iastate.edu/~e_m.274h/singularity%20functions.pdf**http://www.mathalino.com/reviewer/mechanics-and-strength-of-materials/solution-to-problem-403-shear-and-moment-diagrams**https://en.wikipedia.org/wiki/Singularity_function*