% Name: Rembrant Oyangoren Albeos % Singly Reinforced Rectangular Beam Calculator % Inputs fc = input('Compressive strength of concrete, fc (ksi): '); fy = input('Yield strength of steel, fy (ksi): '); b = input('Width of the beam, b (in): '); d = input('Effective depth to centroid, d (in): '); dt = input('Depth to extreme tension layer, dt (in): '); As_choice = input('Input steel area: [1] Area [2] Bar Size: '); if As_choice == 1 As = input('Steel area, As (in^2): '); else Asq = input('Number of bars: '); Asd = input('Bar size: '); As = Asq * (pi * (Asd/8)^2) / 4; fprintf('As: %.3f in^2\n', As); end Es = input('Modulus of Elasticity, Es (ksi): '); Ecu = 0.003; % Tension Force T = As * fy; fprintf('T: %.2f kips\n', T); % Beta 1 if fc <= 4 beta1 = 0.85; elseif fc > 4 && fc <= 8 beta1 = 0.85 - 0.05 * (fc - 4); else beta1 = 0.65; end % Depth of compression block a = T / (0.85 * fc * b); c = a / beta1; fprintf('a: %.3f in\n', a); fprintf('c: %.3f in\n', c); % Steel Strain Strain_y = fy / Es; Strain_s = Ecu * (d - c) / c; fprintf('Ey: %.5f\n', Strain_y); fprintf('Es: %.5f\n', Strain_s); % Check yielding if Strain_s >= Strain_y fprintf('Steel yielded. Assumption OK.\n'); Mn = T * (d - a/2); else fprintf('Steel did NOT yield. Recalculating c...\n'); A_quad = 0.85 * fc * b * beta1; B_quad = As * Es * Ecu; C_quad = -As * Es * Ecu * d; c = (-B_quad + sqrt(B_quad^2 - 4 * A_quad * C_quad)) / (2 * A_quad); a = beta1 * c; Strain_s = Ecu * (d - c) / c; T = As * (Es * Strain_s); Mn = T * (d - a/2); fprintf('Exact c: %.3f in\n', c); fprintf('Exact T: %.2f kips\n', T); end % Nominal Moment Mn_ft = Mn / 12; fprintf('Mn: %.2f kip-in\n', Mn); fprintf('Mn: %.2f kip-ft\n', Mn_ft); % Minimum Steel Area fc_psi = fc * 1000; fy_psi = fy * 1000; limit_check = 3 * sqrt(fc_psi); if limit_check < 200 As_min = (200 / fy_psi) * b * d; else As_min = (limit_check / fy_psi) * b * d; end fprintf('As_min: %.3f in^2\n', As_min); if As >= As_min fprintf('As >= As_min. OK.\n'); else fprintf('As < As_min. FAILED.\n'); end % Strength Reduction Factor Strain_t = Ecu * (dt - c) / c; fprintf('Et: %.5f\n', Strain_t); if Strain_t >= 0.005 phi = 0.90; elseif Strain_t < 0.002 phi = 0.65; else phi = 0.65 + (Strain_t - 0.002) * (250 / 3); end fprintf('phi: %.2f\n', phi); % Design Strength phi_Mn = phi * Mn_ft; fprintf('M: %.2f kip-ft\n', phi_Mn);