× Go Back Go Back to Programming Section Menu Go Back to Home Page
CL625_truck_going_over_ simply_supported_26m_AASHTO_girder.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%               File Name: CL625_truck_going_over_simply_supported_26m_AASHTO_girder               Written by: Koral Eren               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% CL-625 TRUCK ON SINGLE BEAM L>18, Lmax = 100 m %%%%%
 
close all;
clear all;
clc;
 
L = 26;
 
Reactions = zeros(10000, 2);
Moment = zeros(10000, 6);
Shear = zeros(10000, 7);
 
%%%%% INDEXING %%%%%
 
for i = 2:10000
    
	Moment(i, 6) = Moment(i - 1, 6) + 0.01;
	Shear(i, 7) = Shear(i - 1, 7) + 0.01;
    
end
 
%%%%% PEAK VALUES %%%%%
 
i = 1;
for x = 0:0.01:(L + 18)
    
   	if (x > 0 && x <= 3.6)
        	Reactions(i, 1) = 50 * x / L;
    		Reactions(i, 2) = 50 * (1 - x / L);
    		Shear(i, 1) = Reactions(i, 1);
    		Shear(i, 2) = Reactions(i, 1) - 50;
    		Moment(i, 1) = Shear(i, 1) * (L - x);      
	elseif (x > 3.6 && x <= 4.8)
    		Reactions(i, 1) = (175 * x - 450) / L;
    		Reactions(i, 2) = (450 - 175 * x) / L + 175;
    		Shear(i, 1) = Reactions(i, 1);
    		Shear(i, 2) = Reactions(i, 1) - 50;
    		Shear(i, 3) = Reactions(i, 1) - 175;
    		Moment(i, 1) = Shear(i, 1) * (L - x);
    		Moment(i, 2) = Moment(i, 1) + Shear(i, 2) * 3.6;  
	elseif (x > 4.8 && x <= 11.4)
    		Reactions(i, 1) = (300 * x - 1050) / L;
    		Reactions(i, 2) = (1050 - 300 * x) / L + 300;
    		Shear(i, 1) = Reactions(i, 1);
    		Shear(i, 2) = Reactions(i, 1) - 50;
    		Shear(i, 3) = Reactions(i, 1) - 175;
    		Shear(i, 4) = Reactions(i, 1) - 300;
    		Moment(i, 1) = Shear(i, 1) * (L - x);
    		Moment(i, 2) = Moment(i, 1) + Shear(i, 2) * 3.6;
    		Moment(i, 3) = Moment(i, 2) + Shear(i, 3) * 1.2;    
	elseif (x > 11.4 && x <= 18)
    		Reactions(i, 1) = (475 * x - 3045) / L;
    		Reactions(i, 2) = (3045 - 475 * x) / L + 475;
    		Shear(i, 1) = Reactions(i, 1);
    		Shear(i, 2) = Reactions(i, 1) - 50;
    		Shear(i, 3) = Reactions(i, 1) - 175;
    		Shear(i, 4) = Reactions(i, 1) - 300;
    		Shear(i, 5) = Reactions(i, 1) - 475;
    		Moment(i, 1) = Shear(i, 1) * (L - x);
    		Moment(i, 2) = Moment(i, 1) + Shear(i, 2) * 3.6;
    		Moment(i, 3) = Moment(i, 2) + Shear(i, 3) * 1.2;
    		Moment(i, 4) = Moment(i, 3) + Shear(i, 4) * 6.6;    
	elseif (x > 18 && x < L)
    		Reactions(i, 1) = (625 * x - 5745) / L;
    		Reactions(i, 2) = (5745 - 625 * x) / L + 625;
    		Shear(i, 1) = Reactions(i, 1);
    		Shear(i, 2) = Reactions(i, 1) - 50;
    		Shear(i, 3) = Reactions(i, 1) - 175;
    		Shear(i, 4) = Reactions(i, 1) - 300;
    		Shear(i, 5) = Reactions(i, 1) - 475;
    		Moment(i, 1) = Shear(i, 1) * (L - x);
    		Moment(i, 2) = Moment(i, 1) + Shear(i, 2) * 3.6;
    		Moment(i, 3) = Moment(i, 2) + Shear(i, 3) * 1.2;
    		Moment(i, 4) = Moment(i, 3) + Shear(i, 4) * 6.6;
    		Moment(i, 5) = Moment(i, 4) + Shear(i, 5) * 6.6;       
	elseif (x >= L && x < (L + 3.6))
    		Reactions(i, 1) = (575 * x - 5745) / L;
    		Reactions(i, 2) = (5745 - 575 * x) / L + 575;
    		Shear(i, 1) = Reactions(i, 1);
    		Shear(i, 2) = Reactions(i, 1) - 125;
    		Shear(i, 3) = Reactions(i, 1) - 250;
    		Shear(i, 4) = Reactions(i, 1) - 425;
    		Shear(i, 5) = Reactions(i, 1) - 575;
    		Moment(i, 1) = Shear(i, 1) * (3.6 - (x - L));
    		Moment(i, 2) = Moment(i, 1) + Shear(i, 2) * 1.2;
    		Moment(i, 3) = Moment(i, 2) + Shear(i, 3) * 6.6;
    		Moment(i, 4) = Moment(i, 3) + Shear(i, 4) * 6.6;     
	elseif (x >= (L + 3.6) && x < (L + 4.8))
    		Reactions(i, 1) = (450 * x - 5295) / L;
    		Reactions(i, 2) = (5295 - 450 * x) / L + 450;
    		Shear(i, 1) = Reactions(i, 1);
    		Shear(i, 2) = Reactions(i, 1) - 125;
    		Shear(i, 3) = Reactions(i, 1) - 300;
    		Shear(i, 4) = Reactions(i, 1) - 450;
    		Moment(i, 1) = Shear(i, 1) * (L - x + 4.8);
    		Moment(i, 2) = Moment(i, 1) + Shear(i, 2) * 6.6;
    		Moment(i, 3) = Moment(i, 2) + Shear(i, 3) * 6.6;        
	elseif (x >= (L + 4.8) && x < (L + 11.4))
    		Reactions(i, 1) = (325 * x - 4695) / L;
    		Reactions(i, 2) = (4695 - 325 * x) / L + 325;
    		Shear(i, 1) = Reactions(i, 1);
    		Shear(i, 2) = Reactions(i, 1) - 175;
    		Shear(i, 3) = Reactions(i, 1) - 325;
    		Moment(i, 1) = Shear(i, 1) * (L - x + 11.4);
    		Moment(i, 2) = Moment(i, 1) + Shear(i, 2) * 6.6; 
	elseif (x >= (L + 11.4) && x < (L + 18))
    		Reactions(i, 1) = (150 * x - 2700) / L;
    		Reactions(i, 2) = (2700 - 150 * x) / L + 150;
    		Shear(i, 1) = Reactions(i, 1);
    		Shear(i, 2) = Reactions(i, 1) - 150;
    		Moment(i, 1) = Shear(i, 1) * (L - x + 18);      
    	end
    
	i = i + 1;
    
end
 
v = zeros(L / 0.01 + 1, 1);
M = zeros(L / 0.01 + 1, 1);
y = 0:0.01:L;
 
Ve = zeros(L / 0.01 + 1, 1);
Me = zeros(L / 0.01 + 1, 1);
 
%%%%%%%%%%%%% SHEAR %%%%%%%%%%%%%%
 
i = 1;
for x = 0:0.01:0
    
	j = 1;
    	for a = 0:0.01:L
        
        	v(j) = 0;
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);             
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 0.01:0.01:3.6
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x)
        		v(j) = - Shear(i, 2);     
    		else
        		v(j) = - Shear(i, 1);
        	end
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 3.61:0.01:4.8
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 3.6)
            		v(j) = - Shear(i, 3);
    		elseif (a <= x)
        		v(j) = - Shear(i, 2);
        	else
            		v(j) = - Shear(i, 1);
        	end
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 4.81:0.01:11.4
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 4.8)
        		v(j) = - Shear(i, 4);
    		elseif (a <= x - 3.6)
        		v(j) = - Shear(i, 3);
    		elseif (a <= x)
        		v(j) = - Shear(i, 2);
    		else
        		v(j) = - Shear(i, 1);
        	end
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 11.41:0.01:18
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 11.4)
        		v(j) = - Shear(i, 5);
    		elseif (a <= x - 4.8)
        		v(j) = - Shear(i, 4);
    		elseif (a <= x - 3.6)
        		v(j) = - Shear(i, 3);
    		elseif (a <= x)
        		v(j) = - Shear(i, 2);
    		else
        		v(j) = - Shear(i, 1);
        	end
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 18.01:0.01:(L - 0.01)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		v(j) = - Shear(i, 6);
    		elseif (a <= x - 11.4)
        		v(j) = - Shear(i, 5);
    		elseif (a <= x - 4.8)
   	     		v(j) = - Shear(i, 4);
    		elseif (a <= x - 3.6)
        		v(j) = - Shear(i, 3);
    		elseif (a <= x)
        		v(j) = - Shear(i, 2);
    		else
        		v(j) = - Shear(i, 1);
       	 	end
        
        	if (abs(v(j)) > abs(Ve(j)))
            		Ve(j) = v(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = L:0.01:(L + 3.59)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		v(j) = - Shear(i, 5);
    		elseif (a <= x - 11.4)
        		v(j) = - Shear(i, 4);
    		elseif (a <= x - 4.8)
        		v(j) = - Shear(i, 3);
    		elseif (a <= x - 3.6)
        		v(j) = - Shear(i, 2);
    		else
        		v(j) = - Shear(i, 1);
        	end
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);
        	end
        
    		j = j + 1;
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = (L + 3.6):0.01:(L + 4.79)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		v(j) = - Shear(i, 4);
    		elseif (a <= x - 11.4)
        		v(j) = - Shear(i, 3);
	    	elseif (a <= x - 4.8)
        		v(j) = - Shear(i, 2);
    		else
        		v(j) = - Shear(i, 1);
        	end
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
    	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = (L + 4.8):0.01:(L + 11.39)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		v(j) = - Shear(i, 3);
    		elseif (a <= x - 11.4)
        		v(j) = - Shear(i, 2);
    		else
        		v(j) = - Shear(i, 1);
        	end
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = (L + 11.4):0.01:(L + 17.99)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		v(j) = - Shear(i, 2);
    		else
        		v(j) = - Shear(i, 1);
        	end
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
    	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end

for x = (L + 18):0.01:(L + 18)
    
	j = 1;
    	for a = 0:0.01:L
        
    		v(j) = 0;
        
        	if (abs(v(j)) > abs(Ve(j)))
        		Ve(j) = v(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, v);
	xlim([0 L]);
	ylim([- 625 625]);
	axh = gca; % use current axes
	color = 'k'; % black, or [0 0 0]
	linestyle = '-'; % solid
	line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
	pause(0.01);
    
	i = i + 1;
    
end
 
%%%%%%%%%%%%%%% MOMENT %%%%%%%%%%%%%
 
i = 1;
for x = 0:0.01:0
    
	j = 1;
    	for a = 0:0.01:L
        
    		M(j) = 0;
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
        	j = j + 1;
        
    	end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 0.01:0.01:3.6
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x)
        		M(j) = (a / x) * Moment(i, 1);
    		else
        		M(j) = (L - a) / (L - x) * Moment(i, 1);
        	end
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 3.61:0.01:4.8
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 3.6)
        		M(j) = (a / (x - 3.6)) * Moment(i, 2);      
    		elseif (a <= x)
            		if (Moment(i, 2) > Moment(i, 1))
            			M(j) = ((x - a) / 3.6) * (Moment(i, 2) - Moment(i, 1)) + Moment(i, 1);
        		else
            			M(j) = ((a - (x - 3.6)) / 3.6) * (Moment(i, 1) - Moment(i, 2)) + Moment(i, 2);
            		end    
    		else
        		M(j) = (L - a) / (L - x) * Moment(i, 1);
        	end
        
        	if (M(j) > Me(j))
     	   		Me(j) = M(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 4.81:0.01:11.4
    
	j = 1;
    		for a = 0:0.01:L
        
        	if (a <= x - 4.8)
        		M(j) = (a / (x - 4.8)) * Moment(i, 3);
    		elseif (a <= x - 3.6)
        		if (Moment(i, 3) > Moment(i, 2))
            			M(j) = (1.2 - (a - (x - 4.8))) / 1.2 * (Moment(i, 3) - Moment(i, 2)) + Moment(i, 2);
        		else
            			M(j) = (a - (x - 4.8)) / 1.2 * (Moment(i, 2) - Moment(i, 3)) + Moment(i, 3);
        		end
    		elseif (a <= x)
        		if (Moment(i, 2) > Moment(i, 1))
            			M(j) = (3.6 - (a - (x - 4.8 + 1.2))) / 3.6 * (Moment(i, 2) - Moment(i, 1)) + Moment(i, 1);
      	    		else
            			M(j) = (a - (x - 4.8 + 1.2)) / 3.6 * (Moment(i, 1) - Moment(i, 2)) + Moment(i, 2);
        		end
    		else
        		M(j) = (L - a) / (L - x) * Moment(i, 1);
        	end
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
    	j = j + 1;
        
    end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 11.41:0.01:18
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 11.4)
        		M(j) = (a / (x - 11.4)) * Moment(i, 4);
    		elseif (a <= x - 4.8)
        		if (Moment(i, 4) > Moment(i, 3))
            			M(j) = (6.6 - (a - (x - 11.4))) / 6.6 * (Moment(i, 4) - Moment(i, 3)) + Moment(i, 3);
        		else
            			M(j) = (a - (x - 11.4)) / 6.6 * (Moment(i, 3) - Moment(i, 4)) + Moment(i, 4);
        		end
    		elseif (a <= x - 3.6)
        		if (Moment(i, 3) > Moment(i, 2))
            			M(j) = (1.2 - (a - (x - 11.4 + 6.6))) / 1.2 * (Moment(i, 3) - Moment(i, 2)) + Moment(i, 2);
       	    		else
            			M(j) = (a - (x - 11.4 + 6.6)) / 1.2 * (Moment(i, 2) - Moment(i, 3)) + Moment(i, 3);
        		end
    		elseif (a <= x)
        		if (Moment(i, 2) > Moment(i, 1))
            			M(j) = (3.6 - (a - (x - 11.4 + 1.2 + 6.6))) / 3.6 * (Moment(i, 2) - Moment(i, 1)) + Moment(i, 1);
        		else
            			M(j) = (a - (x - 11.4 + 1.2 + 6.6)) / 3.6 * (Moment(i, 1) - Moment(i, 2)) + Moment(i, 2);
        		end
    		else
        		M(j) = (L - a) / (L - x) * Moment(i, 1);
        	end
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = 18.01:0.01:(L - 0.01)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		M(j) = (a / (x - 18)) * Moment(i, 5);
    		elseif (a <= x - 11.4)
        		if (Moment(i, 5) > Moment(i, 4))
            			M(j) = (6.6 - (a - (x - 18))) / 6.6 * (Moment(i, 5) - Moment(i, 4)) + Moment(i, 4);
        		else
            			M(j) = (a - (x - 18)) / 6.6 * (Moment(i, 4) - Moment(i, 5)) + Moment(i, 5);
        		end
    		elseif (a <= x - 4.8)
        		if (Moment(i, 4) > Moment(i, 3))
            			M(j) = (6.6 - (a - (x - 18 + 6.6))) / 6.6 * (Moment(i, 4) - Moment(i, 3)) + Moment(i, 3);
        		else
            			M(j) = (a - (x - 18 + 6.6)) / 6.6 * (Moment(i, 3) - Moment(i, 4)) + Moment(i, 4);
        		end
    		elseif (a <= x - 3.6)
        		if (Moment(i, 3) > Moment(i, 2))
            			M(j) = (1.2 - (a - (x - 18 + 6.6 + 6.6))) / 1.2 * (Moment(i, 3) - Moment(i, 2)) + Moment(i, 2);
        		else
            			M(j) = (a - (x - 18 + 6.6 + 6.6)) / 1.2 * (Moment(i, 2) - Moment(i, 3)) + Moment(i, 3);
    	    		end
    		elseif (a <= x)
        		if (Moment(i, 2) > Moment(i, 1))
            			M(j) = (3.6 - (a - (x - 18 + 1.2 + 6.6 + 6.6))) / 3.6 * (Moment(i, 2) - Moment(i, 1)) + Moment(i, 1);
        		else
            			M(j) = (a - (x - 18 + 1.2 + 6.6 + 6.6)) / 3.6 * (Moment(i, 1) - Moment(i, 2)) + Moment(i, 2);
        		end
    		else
        		M(j) = (L - a) / (L - x) * Moment(i, 1);
        	end
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
    		j = j + 1;
        
    	end
    
    	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = L:0.01:(L + 3.59)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		M(j) = (a / (x - 18)) * Moment(i, 4);
    		elseif (a <= x - 11.4)
 	        	if (Moment(i, 4) > Moment(i, 3))
            			M(j) = (6.6 - (a - (x - 18))) / 6.6 * (Moment(i, 4) - Moment(i, 3)) + Moment(i, 3);
        		else
            			M(j) = (a - (x - 18)) / 6.6 * (Moment(i, 3) - Moment(i, 4)) + Moment(i, 4);
  	        	end
    		elseif (a <= x - 4.8)
        		if (Moment(i, 3) > Moment(i, 2))
            			M(j) = (6.6 - (a - (x - 18 + 6.6))) / 6.6 * (Moment(i, 3) - Moment(i, 2)) + Moment(i, 2);
        		else
            			M(j) = (a - (x - 18 + 6.6)) / 6.6 * (Moment(i, 2) - Moment(i, 3)) + Moment(i, 3);
        		end
    		elseif (a <= x - 3.6)
        		if (Moment(i, 2) > Moment(i, 1))
            			M(j) = (1.2 - (a - (x - 18 + 6.6 + 6.6))) / 1.2 * (Moment(i, 2) - Moment(i, 1)) + Moment(i, 1);
        		else
            			M(j) = (a - (x - 18 + 6.6 + 6.6)) / 1.2 * (Moment(i, 1) - Moment(i, 2)) + Moment(i, 2);
        		end
    		else
        		M(j) = ((L - (14.4 + (x - 18))) - (a - (14.4 + (x - 18)))) / (L - (14.4 + (x - 18))) * Moment(i, 1);
        	end
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = (L + 3.6):0.01:(L + 4.79)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		M(j) = (a / (x - 18)) * Moment(i, 3);
    		elseif (a <= x - 11.4)
        		if (Moment(i, 3) > Moment(i, 2))
            			M(j) = (6.6 - (a - (x - 18))) / 6.6 * (Moment(i, 3) - Moment(i, 2)) + Moment(i, 2);
        		else
            			M(j) = (a - (x - 18)) / 6.6 * (Moment(i, 2) - Moment(i, 3)) + Moment(i, 3);
        		end
    		elseif (a <= x - 4.8)
        		if (Moment(i, 2) > Moment(i, 1))
            			M(j) = (6.6 - (a - (x - 18 + 6.6))) / 6.6 * (Moment(i, 2) - Moment(i, 1)) + Moment(i, 1);
        		else
            			M(j) = (a - (x - 18 + 6.6)) / 6.6 * (Moment(i, 1) - Moment(i, 2)) + Moment(i, 2);
        		end
    		else
        		M(j) = ((L - (13.2 + (x - 18))) - (a - (13.2 + (x - 18)))) / (L - (13.2 + (x - 18))) * Moment(i, 1);
        	end
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = (L + 4.8):0.01:(L + 11.39)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		M(j) = (a / (x - 18)) * Moment(i, 2);
    		elseif (a <= x - 11.4)
        		if (Moment(i, 2) > Moment(i, 1))
            			M(j) = (6.6 - (a - (x - 18))) / 6.6 * (Moment(i, 2) - Moment(i, 1)) + Moment(i, 1);
        		else
            			M(j) = (a - (x - 18)) / 6.6 * (Moment(i, 1) - Moment(i, 2)) + Moment(i, 2);
        		end
    		else
        		M(j) = ((L - (6.6 + (x - 18))) - (a - (6.6 + (x - 18)))) / (L - (6.6 + (x - 18))) * Moment(i, 1);
        	end
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = (L + 11.4):0.01:(L + 17.99)
    
	j = 1;
    	for a = 0:0.01:L
        
        	if (a <= x - 18)
        		M(j) = (a / (x - 18)) * Moment(i, 1);
    		else
        		M(j) = ((L - (x - 18)) - (a - (x - 18))) / (L - (x - 18)) * Moment(i, 1);
        	end
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end

for x = (L + 18):0.01:(L + 18)
    
	j = 1;
    	for a = 0:0.01:L
        
    		M(j) = 0;
        
        	if (M(j) > Me(j))
        		Me(j) = M(j);
        	end
        
    		j = j + 1;
        
    	end
    
	plot(y, M);
	xlim([0 L]);
	ylim([0 2500]);
	pause(0.01);
    
	i = i + 1;
    
end
 
subplot(2, 1, 1);
plot(y, Ve);
axh = gca; % use current axes
color = 'k'; % black, or [0 0 0]
linestyle = '-'; % solid
line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
 
subplot(2, 1, 2);
plot(y, Me);
pause(5);
 
%%%%% TRUCK MOVING FROM RIGHT TO LEFT %%%%%
 
temp1 = zeros((L / 0.01 + 1), 1);
temp2 = zeros((L / 0.01 + 1), 1);
 
for i = 1:(L / 0.01 + 1)
    
	temp1(i) = Ve(i);
	temp2(i) = Me(i);
    
end

for i = 1:(L / 0.01 + 1)
    
	Ve(i) = temp1((L / 0.01 + 1) - i + 1);
	Me(i) = temp2((L / 0.01 + 1) - i + 1);
    
end
 
subplot(2, 1, 1);
plot(y, Ve);
axh = gca; % use current axes
color = 'k'; % black, or [0 0 0]
linestyle = '-'; % solid
line(get(axh, 'XLim'), [0 0], 'Color', color, 'LineStyle', linestyle);
 
subplot(2, 1, 2);
plot(y, Me);
pause(5);
 
%%%%% COMBINED %%%%%
 
for i = 1:(L / 0.01 + 1)
    
	if (abs(temp1(i)) > abs(Ve(i)))
    		Ve(i) = abs(temp1(i));
	else
    		Ve(i) = abs(Ve(i));
    	end
    
    	if (abs(temp2(i)) > abs(Me(i)))
    		Me(i) = abs(temp2(i));
    	else
    		Me(i) = abs(Me(i));
    	end
    
end
 
subplot(2, 1, 1);
plot(y, Ve);
 
subplot(2, 1, 2);
plot(y, Me);
pause(5);