MATLAB: Division by zero error

division by zerosymbolic

I have the following functions in which I am doing a Ritz Method analysis for a tapered cantilever beam, under clamped free conditions.
I am repeatedly getting a zero division error even though I have checked that there are no zeros in the denominators.
Can I know how do I fix this?
I have attached the file code and pasted the lines for reference.
Thanks in advance
>> %Constants
E = 2*10^12; %Young's Modulus
rho = 300; %Density
L = 29; %Length
syms i j y %Declare i, j, y variables
%Variable Equations
o = y/L; %Position Ratios
A = 4.1*(1.005-o); %Area
I = 0.03*(1.005-0.5*o-0.5*o^2); %Moment of Inertia
%Miscellenous
n = 7; %Iterations
%Basis Functions Cosine
phis_i = cos((i-3)*pi*o);
phis_j = cos((j-3)*pi*o);
%For Mc Matrix
sig_fun = rho*A*phis_i*phis_j; %Function for integral a
sigma = int (sig_fun, y, 0, L); %Integral a for y from 0 to L
%Matrices Cosine Series
Mc = zeros (n);
for si = 1:n
for sj = 1:n
Mc(si,sj) = subs (sigma,{i,j},{si,sj});
end
end

Best Answer

%Mc(si,sj) = subs (sigma,{i,j},{si,sj});
t1 = limit(sigma, i, si);
t2 = limit(t1, j, sj);
Mc(si, sj) = t2