ANALYSIS AND DESIGN OF RCC BEAM ELEMENTS USING
MATLAB.
% RCC Beam Design under UDL
clear;
% Input Parameters
b = 230; % Width in mm
L = 4000; % Clear span in mm
cover = 25; % Effective cover in mm
d = 500; % Effective depth assumed in mm
w = 30; % UDL in kN/m
fck = 25; % Concrete grade in N/mm2
fy = 500; % Steel grade in N/mm2
% Calculations
L = L / 1000; % Convert mm to m
w = w * 1e3; % Convert kN/m to N/m
% Bending Moment
Mu = (w * L^2) / 8; % in N.m
Mu = Mu * 1e6; % Convert to N.mm
% Limiting moment capacity
Mu_lim = 0.138 * fck * b * d^2;
fprintf('Mu = %.2f N.mm\n', Mu);
fprintf('Mu_lim = %.2f N.mm\n', Mu_lim);
if Mu <= Mu_lim
fprintf('Section is SAFE in bending. Under-reinforced section.\n');
else
fprintf('Section is OVERSTRESSED. Increase depth or grade.\n');
end
% Design Steel Area
j = 0.9; % lever arm factor
Ast = Mu / (0.87 * fy * j * d);
fprintf('Required Area of Steel Ast = %.2f mm2\n', Ast);
ANALYSIS AND DESIGN OF RCC COLUMN ELEMENTS USING
MATLAB.
% Short Axially Loaded RCC Column Design
% Input Data
b = 300; % Width of column (mm)
D = 500; % Depth of column (mm)
Pu = 1100e3; % Factored axial load (N)
fck = 25; % Concrete grade (MPa)
fy = 500; % Steel grade (MPa)
% Gross Area
Ag = b * D; % mm^2
% Calculate required area of steel (Asc)
numerator = Pu - 0.4 * fck * Ag;
denominator = 0.67 * fy - 0.4 * fck;
Asc = numerator / denominator;
% Minimum and maximum limits as per IS 456:2000
Asc_min = 0.008 * Ag;
Asc_max = 0.06 * Ag;
ANALYSIS AND DESIGN OF RCC SLABS FOR DIFFERENT END CONDITIONS
USING MATLAB.
%% Input Parameters
Lx = input('Enter shorter span (Lx in m): ');
Ly = input('Enter longer span (Ly in m): ');
t = input('Enter slab thickness (mm): ');
load_type = menu('Load Type','UDL','Point Load');
support = menu('Support Condition','Simply Supported (4 sides)','One
End Continuous');
fck = 25; % N/mm2
fy = 415; % N/mm2
cover = 20; % mm
b = 1000; % mm width of strip
% Effective depth
%% Check slab type (one-way or two-way)
if Ly/Lx >= 2
slab_type = 'One-Way';
else
slab_type = 'Two-Way';
end
fprintf('\nDetected Slab Type: %s\n', slab_type);
%% Load Input
if load_type == 1 % UDL
w = input('Enter UDL in kN/m^2: ');
else % Point Load
P = input('Enter Point Load in kN: ');
a = input('Distance from shorter span end (in m): ');
end
d = t - cover;
%% Moment Calculation
if strcmp(slab_type,'One-Way')
L = Lx;
if load_type == 1
w = w * 1e3; % convert to N/m
if support == 1 % Simply Supported
M = (w * L^2) / 8;
else % One end continuous
M = (w * L^2) / 10;
end
else
P = P * 1e3; % N
M = P * a * (L - a) / L; % General formula
end
else
% Two-way slab coefficients (approx from IS 456:2000)
if support == 1 % SSSS
alpha_x = 0.041; alpha_y = 0.031;
else % One end continuous
alpha_x = 0.045; alpha_y = 0.035;
end
w = w * 1e3; % N/m^2
Mx = alpha_x * w * Lx^2;
My = alpha_y * w * Lx^2;
end
%% Reinforcement Calculation
if strcmp(slab_type,'One-Way')
Mu = 1.5 * M; % Factored moment
d_req = sqrt((Mu*1e6)/(0.138*fck*b));
Ast = (Mu*1e6) / (0.87*fy*d); % mm2/m
else
% For Two-way slab, reinforcement in both directions
Mux = 1.5 * Mx;
Muy = 1.5 * My;
d_req_x = sqrt((Mux*1e6)/(0.138*fck*b));
d_req_y = sqrt((Muy*1e6)/(0.138*fck*b));
Ast_x = (Mux*1e6) / (0.87*fy*d); % mm2/m
Ast_y = (Muy*1e6) / (0.87*fy*d); % mm2/m
end
%% Output Results
fprintf('\n--- RCC Slab Design Results ---\n');
fprintf('Effective depth used = %.2f mm\n', d);
if strcmp(slab_type,'One-Way')
fprintf('Factored Moment Mu = %.2f kNm\n', Mu/1e6);
fprintf('Required Ast = %.2f mm2/m\n', Ast);
else
fprintf('Factored Moments: Mux = %.2f kNm, Muy = %.2f kNm\n',
Mux/1e6, Muy/1e6);
fprintf('Required Ast in x-direction = %.2f mm2/m\n', Ast_x);
fprintf('Required Ast in y-direction = %.2f mm2/m\n', Ast_y);
end
%% Minimum Reinforcement Check
Ast_min = 0.0012 * b * t;
fprintf('Minimum Ast required = %.2f mm2/m\n', Ast_min);
ANALYSIS OF A 2D SIMPLY SUPPORTED BEAM WITH UDL USING
MATLAB
clear all;
% Inputs
L = 10; % Beam length in meters
w = 5; % UDL in kN/m
EI = 2e7; % Flexural rigidity (kN.m^2)
x = linspace(0, L, 1000);
% Reaction forces for simply supported beam
RA = w*L/2;
RB = w*L/2;
% Shear Force and Bending Moment
V = RA - w.*x;
M = RA.*x - (w.*x.^2)/2;
% Deflection using double integration method (for UDL on SS beam)
% Max deflection formula:
ymax = (5wL^4) / (384EI)
y_max = (5*w*L^4)/(384*EI);
y = -(w/(24*EI)) * (x.^4 - 2*L*x.^3 + L^3*x); % Beam deflection profile
% Plotting figure;
subplot(3,1,1);
plot(x,V, 'r', 'LineWidth',2);
title('Shear Force Diagram');
xlabel('Beam Length (m)');
ylabel('Shear Force (kN)');
grid on;
subplot(3,1,2);
plot(x,M, 'b', 'LineWidth',2);
title('Bending Moment Diagram');
xlabel('Beam Length (m)');
ylabel('Moment (kNm)');
grid on;
subplot(3,1,3);
plot(x,y, 'g', 'LineWidth',2);
title('Deflection Curve');
xlabel('Beam Length (m)');
ylabel('Deflection (m)');
grid on;
ANALYSIS OF STEEL COLUMN ELEMENTS IN MATLAB
% Analysis of Steel Column Element - Axial Load and Buckling Check
clc;
clear;
% Input Parameters
L = 3; % Length of the column in meters
A = 4000; % Cross-sectional area in mm²
I = 8e6; % Moment of Inertia in mm⁴
E = 2e5; % Modulus of Elasticity in MPa (for steel)
fy = 250; % Yield stress in MPa
K = 1; % Effective length factor (1 for pinned-pinned)
P_applied = 400e3; % Applied axial load in N
% Calculations
L_eff = K * L * 1000; % Effective length in mm
r = sqrt(I / A); % Radius of gyration in mm
lambda = L_eff / r; % Slenderness ratio
% Euler's Critical Buckling Load
P_cr = (pi^2 * E * I) / (L_eff^2); % in N
% Design Capacity (based on yield stress)
P_yield = A * fy; % Axial yield capacity in N
% Safety Check
if P_applied < min(P_cr, P_yield)
status = 'SAFE under applied axial load';
else
status = 'FAILURE possible - exceeds critical capacity';
end
% Display Results
fprintf('\n--- Steel Column Analysis ---\n');
fprintf('Length (m): %.2f\n', L);
fprintf('Area (mm²): %.2f\n', A);
fprintf('Moment of Inertia (mm⁴): %.2e\n', I);
fprintf('Slenderness Ratio (λ): %.2f\n', lambda);
fprintf('Euler Critical Load (N): %.2f\n', P_cr);
fprintf('Yield Load (N): %.2f\n', P_yield);
fprintf('Applied Load (N): %.2f\n', P_applied);
fprintf('Status: %s\n', status);
ANALYSIS OF STEEL BEAM ELEMENTS IN MATLAB
clc;
clear;
% Input Parameters
L = 6; % Length of the beam in meters
b = 150; % Width of the beam in mm
h = 300; % Height (depth) of the beam in mm
E = 2e5; % Modulus of Elasticity of steel in MPa
fy = 250; % Yield strength in MPa
w = 20e3; % UDL in N/m
% Calculations
I = (b * h^3) / 12; % Moment of inertia in mm^4
Z = I / (h / 2); % Section modulus in mm^3
% Maximum Bending Moment for UDL on Simply Supported
Beam
M_max = (w * L^2) / 8; % in N·m
M_max_mm = M_max * 1e3; % convert to N·mm
% Bending Stress
f_bending = M_max_mm / Z; % in MPa
% Shear Force (max) for UDL on Simply Supported Beam
V_max = (w * L) / 2; % in N
A = b * h; % Cross-sectional area in mm²
tau_avg = V_max * 1e3 / A; % Average shear stress in MPa
% Maximum Deflection for UDL on Simply Supported Beam
delta_max = (5 * w * L^4) / (384 * E * I * 1e-12); % in mm
% Safety Check
if f_bending < fy
status = 'SAFE under given loading';
else
status = 'UNSAFE - bending exceeds yield strength';
end
% Display Outputs
fprintf('\n--- Steel Beam Analysis ---\n');
fprintf('Beam Length (m): %.2f\n', L);
fprintf('Section (b x h in mm): %d x %d\n', b, h);
fprintf('Moment of Inertia (mm⁴): %.2e\n', I);
fprintf('Section Modulus (mm³): %.2e\n', Z);
fprintf('Max Bending Moment (N·m): %.2f\n', M_max);
fprintf('Bending Stress (MPa): %.2f\n', f_bending);
fprintf('Max Shear Force (N): %.2f\n', V_max);
fprintf('Average Shear Stress (MPa): %.2f\n', tau_avg);
fprintf('Max Deflection (mm): %.2f\n', delta_max);
fprintf('Status: %s\n', status);
ANALYSIS OF COLD-FORMED STEEL
clc;
clear;
%% ----- Steel Type Selection -----
disp('Select Steel Type:');
disp('1 = Cold-Formed Steel (CFS)');
disp('2 = Hot-Rolled Steel (HRS)');
steel_type = input('Enter option number (1 or 2): ');
if steel_type == 1
steel_name = 'Cold-Formed Steel (CFS)';
Fy = 250; % Yield Strength in MPa
design_code = 'IS 801 / AISI S100';
elseif steel_type == 2
steel_name = 'Hot-Rolled Steel (HRS)';
Fy = 350; % Yield Strength in MPa
design_code = 'IS 800 / AISC 360';
else
disp('Invalid input. Exiting...');
return;
end
E = 200000; % Modulus of Elasticity for both types (MPa)
fprintf('\nSelected Steel Type: %s\nDesign Code: %s\n', steel_name,
design_code);
%% ----- Section Geometry -----
t = 2; % Thickness (mm)
b = 60; % Flange width (mm)
h = 120; % Web height (mm)
L = 2000; % Length of member (mm)
%% ----- Load Inputs -----
fprintf('\nEnter the following loads:\n');
P = input('Axial Load P (N): ');
M = input('Bending Moment M (Nmm): ');
V = input('Shear Force V (N): ');
%% ----- Section Properties (C-section approx) -----
A = 2*b*t + h*t; % Cross-sectional Area (mm²)
I = (b*h^3)/12; % Moment of Inertia (mm⁴)
y = h/2; % Distance to extreme fiber
Z = I / y; % Section Modulus (mm³)
Q = A * (h/4); % First moment of area
P_cr = (pi^2 * E * I) / (L^2); % Euler buckling load (N)
%% ----- Load Case Selection -----
fprintf('\nSelect Load Case:\n1 = Axial\n2 = Bending\n3 = Shear\n4 = Combined\n');
load_case = input('Enter your choice: ');
%% ----- Load Case Analysis -----
switch load_case
case 1 % Axial
sigma_axial = P / A;
fprintf('\n--- Axial Load Analysis ---\n');
fprintf('Axial Stress = %.2f MPa\n', sigma_axial);
fprintf('Euler Buckling Load = %.2f kN\n', P_cr/1000);
if sigma_axial > Fy
disp('Axial stress exceeds Fy!');
end
if P > P_cr
disp('Buckling risk: P > Pcr!');
end
case 2 % Bending
sigma_bending = M * y / I;
fprintf('\n--- Bending Load Analysis ---\n');
fprintf('Bending Stress = %.2f MPa\n', sigma_bending);
if sigma_bending > Fy
disp('Bending stress exceeds Fy!');
end
case 3 % Shear
tau_shear = V * Q / (I * t);
fprintf('\n--- Shear Load Analysis ---\n');
fprintf('Shear Stress = %.2f MPa\n', tau_shear);
if tau_shear > 0.6 * Fy
disp('Shear stress exceeds 0.6 Fy!');
end
case 4 % Combined
sigma_axial = P / A;
sigma_bending = M * y / I;
tau_shear = V * Q / (I * t);
sigma_combined = sigma_axial + sigma_bending;
fprintf('\n--- Combined Load Analysis ---\n');
fprintf('Axial Stress = %.2f MPa\n', sigma_axial);
fprintf('Bending Stress = %.2f MPa\n', sigma_bending);
fprintf('Combined Stress = %.2f MPa\n', sigma_combined);
fprintf('Shear Stress = %.2f MPa\n', tau_shear);
fprintf('Euler Buckling Load = %.2f kN\n', P_cr/1000);
if sigma_combined > Fy
disp('Combined stress exceeds Fy!');
end
if tau_shear > 0.6 * Fy
disp('Shear stress exceeds 0.6 Fy!');
end
if P > P_cr
disp('Buckling risk: P > Pcr!');
end
otherwise
disp('Invalid load case selected.');
end