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...
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?
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.
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
Using Matlab, create a code that determines the highest real root of f(x)=x3-6x2+11x-6.1 using the Newton-Raphson...
Using Matlab, create a code that determines the highest real root of f(x)=x3-6x2+11x-6.1 using the Newton-Raphson method with x0=3.5 for three iterations. Verify that the process is quadratically convergent. I found the code to get the highest real root (root for three iterations = 3.0473), however, I do not know how to verify that it is quadratically convergent.
Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft...
Hello, I need the Matlab code of the Fourier Transform without using the Matlab functions fft and dft. Applied to discrete signals. If you can with an example.Thank you!!
I want the code for the 2D Ising model using Matlab
I want the code for the 2D Ising model using Matlab
(1)Using the Matlab code developed in Software Assignment #1: a. Convert the code that generates the...
(1)Using the Matlab code developed in Software Assignment #1: a. Convert the code that generates the random number (H,T) with equal probabilities into a function called myBernolli(p, S) that takes as an input the probability of success p and S is the outcome defined as success (either T or H) and returns the outcome of the trial (either T or H). b. Test that your function is actually producing the successful outcome with probability p by running the function in...
Matlab code problems I have to write a code using functions to find out if a...
Matlab code problems I have to write a code using functions to find out if a year is a leap year. I'm on the write track i feel like but I keep getting an error message and matlab isnt helping to troubleshoot. The issue is on line 30. Here is my code: function project_7_mfp() %   PROJECT_7_ABC   project_7_abc() creates a function that prompts the user %   enter a year after 1582 It then determines if it is a leap year %...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT