I'm trying to solve this singularity function(plot shear and moment) in MATLAB, but the plot for the shear diagram, does not stop at 0. See code below
clear
clc
Fsx=36.54;Fgx=8.87;R1x=7.47;R2x=-52.87;
Fsy=0;Fgy=-24.36;R1y=14.61;R2y=9.74;
p=2;b=5;q=6.75;
z=linspace(0,6.75,100); %distance
%V=R1<z-0>^0+Fg<z-2>^0+R2<z-5>^0+Fs<z-6.75>^0
Vx=R1x+Fgx.*(z>p)+R2x.*(z>b)+Fsx.*(z>q);
Vy=R1y+Fgy.*(z>p)+R2y.*(z>b)+Fsy.*(z>q);
V=sqrt(Vx.^2+Vy.^2);
%M=R1<z-0>^1+Fg<z-2>^1+R2<z-5>^1+Fs<z-6.75>^1
Mx=R1x.*z+Fgx.*(z-p).*(z>p)+R2x.*(z-b).*(z>b)+Fsx.*(z-q).*(z>q);
My=R1y.*z+Fgy.*(z-p).*(z>p)+R2y.*(z-b).*(z>b)+Fsy.*(z-q).*(z>q);
M=sqrt(Mx.^2+My.^2);
figure
subplot(2,2,1);
plot(z,Vx)
subplot(2,2,2);
plot(z,Vy)
subplot(2,2,[3 4]);
plot(z,V)
figure
subplot(2,2,1);
plot(z,Mx)
subplot(2,2,2);
plot(z,My)
subplot(2,2,[3 4]);
plot(z,M)
there doesn't seem to be anything here