Question
do this in matlab function guide function [area_rectangle,x_rectangle,y_rectangle] = geo_rectangle(....) % GEO_RECT Computes geometric properties of a rectangle area_rectangle = height*width; y_rectangle = height/2; x_rectangle
do this in matlab function guide
function [area_rectangle,x_rectangle,y_rectangle] = geo_rectangle(....)
% GEO_RECT Computes geometric properties of a rectangle
area_rectangle = height*width;
y_rectangle = height/2;
x_rectangle = width/2;
end
function [area_trapezoid,x_trapezoid,y_trapezoid] = geo_trapezoid(w3,w1,h2)
% GEO_trapezoid Computes geometric properties of a trapezoid
area_trapezoid = h2*(w3+w1)/2;
c = (w1 - w3)/2;
x_trapezoid = (2*w3*c+w3^2+c*w1+w3*w1+w1^2)/(3*(w3+w1));
y_trapezoid = h2*(2*w3+w1)/(3*(w3+w1));
end
function [areaCol,xCol,....] = geo_column(x1,x2,x3,....)
% This function calculates geometrical properties like total area and
% centroid coordinates
end
function [%output variables] = three_col(% input variables)
% function call for geo_rectangle, geo_trapezoid to get areas and
% x1,y1....
% function call for geocolumn to get centroid and total area.
end
2. From previous examples we are able to determine the center of mass (CM) of a three-section column for a given set of dimensions. However we can create a function to input ANY other value for these dimensions and determine the CM for a given configuration. (i) Create a function three col that inputs wi, h1, h2, h3, w3 and outputs areaCol, Col, yCol. Save this function in lib/ folder. MAE 215 Homework 2 Figure 2: General cross-section of a bridge column (ii) Within this function determine area, x and y coods of each section using the geo_rectangle(width, height) and geo-trapezoid(width, height) functions (see part 1b, 1ci) (iii) Then determine the total area, x and y cood of the entire column using geo_column (see part lcii) (iv) Witin HW2 script, run geo_column three times, each with a different set of heights and widths (see HW guide). (v) Using fprintf, print area, x and y coordinates of three other sets of columns with dimensions in the table format: column width=10, precision=3, alignment=left. Do not print from the function! area X_center y_center Coli areaCol1 xCol1 yCol1 Col2 areaCol2 xCol2 yCol2 Col3 areaCol3 xCol3yCol3 2. From previous examples we are able to determine the center of mass (CM) of a three-section column for a given set of dimensions. However we can create a function to input ANY other value for these dimensions and determine the CM for a given configuration. (i) Create a function three col that inputs wi, h1, h2, h3, w3 and outputs areaCol, Col, yCol. Save this function in lib/ folder. MAE 215 Homework 2 Figure 2: General cross-section of a bridge column (ii) Within this function determine area, x and y coods of each section using the geo_rectangle(width, height) and geo-trapezoid(width, height) functions (see part 1b, 1ci) (iii) Then determine the total area, x and y cood of the entire column using geo_column (see part lcii) (iv) Witin HW2 script, run geo_column three times, each with a different set of heights and widths (see HW guide). (v) Using fprintf, print area, x and y coordinates of three other sets of columns with dimensions in the table format: column width=10, precision=3, alignment=left. Do not print from the function! area X_center y_center Coli areaCol1 xCol1 yCol1 Col2 areaCol2 xCol2 yCol2 Col3 areaCol3 xCol3yCol3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started