Question

In: Mechanical Engineering

Using MATLAB create a code to locate the centriod and moments of interia about the centriod...

Using MATLAB create a code to locate the centriod and moments of interia about the centriod of a stiffened rectangular plate with or without cut outs,

Solutions

Expert Solution

This program gives centroid and moment of inertia as output for coordinates of rectangle as input

Save the code as "Rect.m"

let x be x-coordinates of rectangle and y be y-coordinate of rectangle
call the program as "Rect(x,y)"

example:

x = [ 2.000 0.500 4.830 6.330 ]';
y = [ 4.000 6.598 9.098 6.500 ]';
Rect(x,y)

OUTPUT:

x_cen=3.415, y_cen=6.549
Ixx=659.561, Iyy=201.173, Ixy=344.117

__________________________________________________________________

function [ Centroid, M_Inertia ] = Rect( x, y )
if ~isequal( size(x), size(y) )

error( 'X and Y must be the same size');
end

xm = mean(x);
ym = mean(y);
x = x - xm;
y = y - ym;
  
xp = x( [2:end 1] );
yp = y( [2:end 1] );
a = x.*yp - xp.*y;

A = sum( a ) /2;
xc = sum( (x+xp).*a ) /6/A;
yc = sum( (y+yp).*a ) /6/A;
Ixx = sum( (y.*y +y.*yp + yp.*yp).*a ) /12;
Iyy = sum( (x.*x +x.*xp + xp.*xp).*a ) /12;
Ixy = sum( (x.*yp +2*x.*y +2*xp.*yp + xp.*y).*a ) /24;

dx = xp - x;
dy = yp - y;
P = sum( sqrt( dx.*dx +dy.*dy ) );

if A < 0,
A = -A;
Ixx = -Ixx;
Iyy = -Iyy;
Ixy = -Ixy;
end

Iuu = Ixx - A*yc*yc;
Ivv = Iyy - A*xc*xc;
Iuv = Ixy - A*xc*yc;
J = Iuu + Ivv;

x_cen = xc + xm;
y_cen = yc + ym;
Ixx = Iuu + A*y_cen*y_cen;
Iyy = Ivv + A*x_cen*x_cen;
Ixy = Iuv + A*x_cen*y_cen;

I = [ Iuu -Iuv ;
-Iuv Ivv ];
[ eig_vec, eig_val ] = eig(I);
I1 = eig_val(1,1);
I2 = eig_val(2,2);
ang1 = atan2( eig_vec(2,1), eig_vec(1,1) );
ang2 = atan2( eig_vec(2,2), eig_vec(1,2) );

Centroid= [ A x_cen y_cen P ];
M_Inertia = [ Ixx Iyy Ixy };

end

________________________________


Related Solutions

write a matlab code of current distribution in wire antenna using method of moments (pocklington)
write a matlab code of current distribution in wire antenna using method of moments (pocklington)
This is a Matlab Exercise problem. Please create the Matlab code and figure for the following...
This is a Matlab Exercise problem. Please create the Matlab code and figure for the following problem using problem specifications: Plot x vs y when y=sin(x), y=cos(x), y=sin (2*x), and y=2*sin(x) when x = 1:0.1:10. Use 2 by 2 subplot, sin(x) is in location 1, cos(x) is in location 2, sin(2*x) is in location 3 and 2*sin(x) is in location 4. The plot should have: (1) x label = ‘x value’, y label = ‘y value’, legend ‘y=sin(x)’,’ y=cos(x)’,’ y=sin...
The following code must be written using matlab Create a contour plot of the following function...
The following code must be written using matlab Create a contour plot of the following function f(x,y) = (x+y^2-10)^2 +(x^2+y^2+8) in range [-6,6] for both x and y Clearly indicate in the plot the coordinates of the minimum ponts and the the corresponding function values in these points
Using Matlab, write code that carries out the following instructions: **Within your Live Script, create a...
Using Matlab, write code that carries out the following instructions: **Within your Live Script, create a matrix A by starting with eye(5) and performing the following sequence of elementary row-operations: first, replace (row4) with [(row4) + (row2) ⋅3], then, interchange rows 1 and 3 of the obtained matrix, and, finally, scale row5 of the matrix from the previous step by 6 to get the output matrix A. Display A. Note: To complete this part, you, should, first, create (and output)...
• In this script, write MATLAB code to create an array A of size 100 ×...
• In this script, write MATLAB code to create an array A of size 100 × 3. The first column should contain random numbers between 0 and 10. The second column should also contain random numbers between 0 and 10. The third column should contain random integers between 20 and 50. The first two columns represent the x and y coordinates of a map, respectively. The third column represents the height of buildings. For example, if the first row of...
How would I go about making a simple code for an analog clock using matlab?
How would I go about making a simple code for an analog clock using matlab?
The following code must be written using matlab How to loop through a vector in matlab...
The following code must be written using matlab How to loop through a vector in matlab and assigning a value to every 4th entry. The vector could be of any length. Thanks
Create matlab simulink model for dc-dc buck converter with screenshot. Note: provide matlab code for the...
Create matlab simulink model for dc-dc buck converter with screenshot. Note: provide matlab code for the output of dc-dc buck converter if possible.
**MATLAB Code only Please create a MATLAB script that is a TIC-TAC-TOE game. Please keep it...
**MATLAB Code only Please create a MATLAB script that is a TIC-TAC-TOE game. Please keep it simple, but there is no other rules. Thank you.
Write the MATLAB code to Create a new figure. Define a theta array such that ?...
Write the MATLAB code to Create a new figure. Define a theta array such that ? 2 ≤ ? ≤ 9? 2 with increment of ? 10 ; Create a sixmember array of ones called r. Create a new polar plot of ? versus r
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT