Matlab- Second moment of Area(I) Script Help

In summary, the conversation is about a student seeking help with designing a cantilever beam for atomic force microscopy in a Mechanics of Materials class. The student has been tasked with writing a MATLAB script to calculate the coordinates of the centroid, second moment of area, and required Q for maximum shear stress. The student has already completed part A and is struggling with part B, and is looking for assistance from someone with more programming experience. Pseudocode is suggested as a starting point for writing the code.
  • #1
lunarskull
28
0
Hi,

I am in Mechanics of materials class, and I am attempting to design a cantilever beam that meets certain specifications for atomic Force microscopy. (details aren't relevant for programming steps).

I have been tasked with writing a script in MATLAB that:

A.) Calculates the coordinates of the centroid of any Cross section.
B.) Calculates the second moment of area (I) about the centroidal Z-axis (assume this axis is horizontal)
C.) Calculates the Q that is needed to compute the maximum shear stress.

For the above tasks, assume the resolution of the image is 1 nm/pixel.

I have already created the m-file for 1 of the images that I will be using . (it is a ring cross-section). It is attached.

I have also finished Part (A), and I think it works.

The centroid is basically the center of mass of a 2-d object.

Part B is really giving me trouble, I can't seem to make any headway towards getting the correct solution.

The equation for calculating the second moment of Area is: I=Integral(Y^2*dA) (A=area).

If someone with more programming knowledge/experience than me can help, that would be lifesaving!

The attached m files that I have finished are attached.

-Ryan
View attachment centroid2.m

View attachment ring.m
 
Physics news on Phys.org
  • #2
This should probably be in the Math and Scientific Software section of the CS forum. This really isn't a programming question.
 
  • #3
Try showing us some psuedocode for what you're trying to do - I think writing this code will be easier than you think. You need to assume that each pixel has area dA. Here is a start:

Code:
for every pixel
    if (is part of the object)
        get distance from centroid in y-direction (you already know where "0" is...)
        ...
    else -> do nothing
next pixel


Hope this helps,

Kerry
 

1. What is the Second Moment of Area (I) in Matlab?

The Second Moment of Area (I) in Matlab is a measure of a shape's resistance to bending or torsion. It is a calculation of the distribution of an object's mass around an axis, and is used to determine the object's overall stiffness and strength.

2. How do I calculate the Second Moment of Area (I) in Matlab?

To calculate the Second Moment of Area (I) in Matlab, you can use the momentofinertia function, which takes in the shape's coordinates as input. You can also use the area function to calculate the area of the shape, and then use the formula I = (1/12)*area*(height^3) to calculate the Second Moment of Area.

3. What is the difference between Second Moment of Area (I) and Moment of Inertia (Ixx) in Matlab?

The Second Moment of Area (I) and Moment of Inertia (Ixx) are two different measures of an object's resistance to bending or torsion. The Second Moment of Area is a measure of the distribution of mass around an axis, while the Moment of Inertia is a measure of the object's moment of inertia around a specific axis. In Matlab, the Moment of Inertia is calculated using the momentofinertia function, while the Second Moment of Area is calculated using a formula or the area function.

4. Can I plot the Second Moment of Area (I) in Matlab?

Yes, you can plot the Second Moment of Area (I) in Matlab using the plot function. You will need to first calculate the Second Moment of Area for a range of points, and then use the plot function to plot the points on a graph. You can also use the fill function to create a shaded region representing the Second Moment of Area.

5. Can I use the Second Moment of Area (I) in Matlab for 3D shapes?

Yes, the Second Moment of Area (I) can be calculated and used for 3D shapes in Matlab. You will need to use the momentofinertia function and specify the axes of rotation for the shape. The formula for calculating the Second Moment of Area for a 3D shape is I = (1/12)*volume*(height^2), where volume is the volume of the 3D shape and height is the distance from the centroid to the axis of rotation.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • General Engineering
Replies
4
Views
3K
Replies
3
Views
2K
  • Advanced Physics Homework Help
Replies
15
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
315
  • Mechanical Engineering
Replies
7
Views
2K
  • Mechanical Engineering
2
Replies
36
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • Mechanical Engineering
Replies
2
Views
937
Back
Top