Matlab – calculate geometric properties, engineering homework help

Attached is the code I have already created..

I need help figuring out how to plot each option, and I need to add another option to calculate the geometric properties of an arbitrary shape (something not considered to be a rectangle, circle, triangle, etc.)(something irregular).

% Option #4: Calculate geometric properties of arbitrary 2D shapes

_x000D_

% Area, Moments of inertia

_x000D_ _x000D_

while 1

_x000D_ _x000D_

    fprintf('nttMenun');

_x000D_ _x000D_

    fprintf('1. Rectangle or parallelogramn');

_x000D_ _x000D_

    fprintf('2. Hollow Rectangular Sectionn');

_x000D_ _x000D_

    fprintf('3. Circular Sectionn');

_x000D_ _x000D_

    fprintf('4. Hollow Circular Sectionn');

_x000D_ _x000D_

    fprintf('5. Triangle n');

_x000D_ _x000D_

    fprintf('6. I-beam n')

_x000D_ _x000D_

    fprintf('7. Exit n');

_x000D_ _x000D_

    x = input('Enter your option: ');

_x000D_ _x000D_

    switch(x)

_x000D_ _x000D_

      case 1 

_x000D_ _x000D_

          fprintf('nRectangle or paralleogramn');

_x000D_ _x000D_

          b = input('Enter the width: ');

_x000D_ _x000D_

          d = input('Enter the height: ');

_x000D_ _x000D_

          Ixx = (b*d^3)/12;

_x000D_ _x000D_

          Iyy = (d*b^3)/12;

_x000D_ _x000D_

          A = b*d;

_x000D_ _x000D_

          fprintf('Area = %.2fn',A);

_x000D_ _x000D_

          fprintf('Moment of Inertia Ixx = %.2fn',Ixx);

_x000D_ _x000D_

          fprintf('Moment of Inertia Iyy = %.2fn',Iyy);

_x000D_ _x000D_

         

_x000D_

      case 2 

_x000D_ _x000D_

          fprintf('nHollow Rectangular Sectionn');

_x000D_ _x000D_

          b = input('Enter the outside width: ');

_x000D_ _x000D_

          d = input('Enter the outside height: ');

_x000D_ _x000D_

          b1 = input('Enter the inner width: ');

_x000D_ _x000D_

          d1 = input('Enter the inner height: ');

_x000D_ _x000D_

          Ixx = (b*d^3)/12-(b1*d1^3)/12;

_x000D_ _x000D_

          Iyy = (d*b^3)/12-(d1*b1^3)/12;

_x000D_ _x000D_

          A = b*d-b1*d1;

_x000D_ _x000D_

          fprintf('Area = %.2fn',A);

_x000D_ _x000D_

          fprintf('Moment of Inertia Ixx = %.2fn',Ixx);

_x000D_ _x000D_

          fprintf('Moment of Inertia Iyy = %.2fn',Iyy);

_x000D_ _x000D_

      case 3 

_x000D_ _x000D_

          fprintf('nCircular Sectionn');

_x000D_ _x000D_

          d = input('Enter the diameter: ');

_x000D_ _x000D_

          Ixx = (pi*d^4)/64;

_x000D_ _x000D_

          Iyy = Ixx;

_x000D_ _x000D_

          A = (pi*(d/2)^2);

_x000D_ _x000D_

          fprintf('Area = %.2fn',A);

_x000D_ _x000D_

          fprintf('Moment of Inertia Ixx = %.2fn',Ixx);

_x000D_ _x000D_

          fprintf('Moment of Inertia Iyy = %.2fn',Iyy);

_x000D_ _x000D_

      case 4

_x000D_ _x000D_

          fprintf('nHollow circular sectionn');

_x000D_ _x000D_

          d = input('Enter the inner diameter: ');

_x000D_ _x000D_

          D = input('Enter the outside diameter: ');

_x000D_ _x000D_

          Ixx = (pi/64)*(D^4-d^4);

_x000D_ _x000D_

          Iyy = Ixx;

_x000D_ _x000D_

          A = pi*((D/2)^2)-((d/2)^2);

_x000D_ _x000D_

          fprintf('Area = %.2fn',A);

_x000D_ _x000D_

          fprintf('Moment of Inertia Ixx = %.2fn',Ixx);

_x000D_ _x000D_

          fprintf('Moment of Inertia Iyy = %.2fn',Iyy);

_x000D_ _x000D_

      case 5 

_x000D_ _x000D_

          fprintf('nTrianglen');

_x000D_ _x000D_

          b = input('Enter the width: ');

_x000D_ _x000D_

          h = input('Enter the height: ');

_x000D_ _x000D_

          Ig = (b*h^3)/36;

_x000D_ _x000D_

          A = (b*h)/2;

_x000D_ _x000D_

          fprintf('Area = %.2fn',A);

_x000D_ _x000D_

          fprintf('Moment of Inertia Ig = %.2fn',Ig);

_x000D_ _x000D_

        case 6

_x000D_ _x000D_

          fprintf('nI-Sectionn');

_x000D_ _x000D_

          d = input('Enter the height: ');

_x000D_ _x000D_

          d1 = input('Enter the inner height (d1): ');

_x000D_ _x000D_

          b = input('Enter the width: ');

_x000D_ _x000D_

          b1 = input('Enter the inner width (b1): ');

_x000D_ _x000D_

          Ixx = (b*d^3)/12-(b1*d1^3)/12;

_x000D_ _x000D_

          Iyy = (d*b^3)/12-(d1*b1^3)/12;

_x000D_ _x000D_

          A = b*(d-d1)+(d1*(b-b1));

_x000D_ _x000D_

          fprintf('Area = %.2fn',A);

_x000D_ _x000D_

          fprintf('Moment of Inertia Ixx = %.2fn',Ixx);

_x000D_ _x000D_

          fprintf('Moment of Inertia Iyy = %.2fn',Iyy);

_x000D_ _x000D_

       

_x000D_ _x000D_

        case 7

_x000D_ _x000D_

            break;

_x000D_ _x000D_

      otherwise

_x000D_ _x000D_

          fprintf('Invalid optionn' );

_x000D_ _x000D_

    end

_x000D_ _x000D_

end


 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.