MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
Asked by Tae Yeong Kim on 23 Jun 2013

I am trying to calculate the limits (range) of the center of gravity of two masses (boxes) when there is a force that hit the masses.

Above is the free body diagram of the two masses, and the equation; however, how would I convert this to Matlab compatible equation or code?

I will appreciate all the answers

*No products are associated with this question.*

Answer by Roger Stafford on 23 Jun 2013

Edited by Roger Stafford on 23 Jun 2013

Let the lower box have width a and height b, and for the upper box width c and height d. Let e be the amount the upper box is offset from the right edge of the lower box. Assuming the lower left corner of the lower box is the coordinate origin and assuming uniform densities, the centers would be:

c1 = [a/2;b/2]; % c.g. before rotation by phi c2 = [e+c/2;b+d/2]; R = [cos(phi),-sin(phi);sin(phi),cos(phi)]; % rotation matrix c1 = R*c1; % c.g. after rotation by phi c2 = R*c2;

You still haven't said where there is any "range" involved.

The centers of gravity don't depend on the moment of inertia. The effect of the impulse force on the boxes does.

The moment of inertia computation will also have to involve a, b, c, d, and e. I'll leave that one to you.

## 2 Comments

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/79971#comment_156489

Calculating the center of gravity for the two boxes in your diagram should be a matter of simple geometry if their densities are uniform, given their dimensions, relative positions, and the angle phi. In what way do you see a "range" of possible values for this?

As to the effect on the boxes of the impulse force you depict, you need more than their center of gravity to determine that. You also need their moment of inertia, since there is a torque involved.

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/79971#comment_156490

Thank you for your effort, and what kind of equation would you use to calculate the c.g. with the moment of inertia given?