Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use If statements to meet the criteria for part B A circular cross section of a

ID: 3823719 • Letter: U

Question

Use If statements to meet the criteria for part B

A circular cross section of a cantilevered bar undergoes bending moments and a torque (M_1 = 3600 lbf middot in, M_2 = 2750 lbf middot in, M_3 = 3000 lbf middot in, T = 2200 lbf middot in), and has diameter of 1 inch. A two-dimensional state of stress at a point in the loaded bar is defined by three components of stresses: sigma_xx, sigma_yy, and tau_xy. sigma_xx = (M_1 cos theta + M_2 sin theta)r/I, sigma_yy = -(M_3 cos theta)r/I, tau = Tr/J, J = 2I = pi/32 d^4 Create a function with r and theta as inputs and an output based on the criteria. Use if statements to meet the following criteria If the values of r and theta given as scalars, return the values of the three stress components. If the values of r and theta given as vectors, only create a surface plot (surf) for the stress distribution of each stress component. Test your function by letting r = 0.25 and theta = pi/6 r =[0 0.5] and theta = [0 2 pi], choose appropriate increment.

Explanation / Answer


function [sigxx sigyy txy] = calc(r,theta)
M1 = 3600;
M2 = 2750;
M3 = 3000;
T = 2200;
d = 1;
I = pi/64*d^4;
sigxx = (M1 * cos(theta) + M2 * sin(theta))*r/I;
sigyy = -(M3 * cos(theta))*r/I;
txy = T*r/(2*I);
end

func [sigxx sigyy txy] = stress(r,theta)
szr = size(r);
szt = size(theta);
if szr(1)==1 && szr(2)==1 && szt(1)==1 && szt(2)==1
[sigxx sigyy txy] = calc(r,theta)
else
sigxx = rand (szr);
sigyy = rand (szr);
txy = rand (szr);
for i = 1 : szr(2)
[sigxx(i) sigyy(i) txy(i)] =calc(r(i),theta(i));
end
figure
[x,y] = pol2cart(sigxx,r)
surf(xy);
figure
[x,y] = pol2cart(sigyy,r)
surf(xy);
figure
[x,y] = pol2cart(txy,r)
surf(xy);
end


end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote