## XMAX must be a floating point scalar in double integral. Kindly help.

Asked by Swathi S

### Swathi S (view profile)

on 23 Aug 2019
Latest activity Answered by Walter Roberson

### Walter Roberson (view profile)

on 23 Aug 2019
Accepted Answer by Walter Roberson

### Walter Roberson (view profile)

CODE:
x=0
y=0
u0=4*pi*(10^-7);
f=5*10^6;
w=2*pi*f;
u=4*pi*(10^-7);
U=2;
a=0.5
N=5
for d=0.1:0.1:1
s=0.001
N=5
wd=0.011
r0=0.0001608
e=7*(8.854*10^-12) %dry sand check again
sig=0.11 %variable so check again
alpha=3.9*10^-3 %temp coeff
T=26 %soil temp
T0=33 %room temp
dout=2*a
d1=sqrt(2)*a
aw=wd./2
din=dout-(2*N*wd)-(2*(N-2)*s)
davg=(dout-din)./(dout+din)
ltc=4.*N.*(dout-(N-1).*(wd+s)) %ORIGINAL CORRECT
Aw=pi.*(aw.^2)
R=(r0.*ltc.*(1+alpha.*(T-T0)))./Aw
theta=90
J=2.*sin(theta).*sin(theta)+cos(theta).*cos(theta)
sd=(w.*(sqrt((u.*e./2).*(sqrt(1+(sig./(w.*e))^2)-1))))^(-1)
G=exp(-d./sd)
Mt1=0
Bz=@(ai) (((u)/(2*pi*sqrt(((r0+ai)^2)+(d^2))))*((ellipticK(pi/2))+(((-r0^2-d^2+ai^2)/((r0-ai)^2+d^2))*ellipticE(pi/2))))
M=zeros(1,N*N)
for i=1:1:N
ai=a-2*(N-1)*wd-2*(N-1)*s:2*(wd+s):a-2*(N-N)*wd-2*(N-N)*s
for j=1:1:N
aj=a-2*(N-1)*wd-2*(N-1)*s:2*(wd+s):a-2*(N-N)*wd-2*(N-N)*s
M=integral2(Bz,0,ai,0,aj)
end
end
Mt1=Mt1+M
Mtotal=Mtl*J*G
end
end
ERROR:
Error using integral2 (line 76)
XMAX must be a floating point scalar.
Error in FPSCCLM2 (line 93)
M=integral2(Bz,0,ai,0,aj)

### Tags ### Walter Roberson (view profile)

Answer by Walter Roberson

on 23 Aug 2019