I have the following code:
clc,clear all,close allfilename='d5D21Re50.csv';M=csvread(filename,1,0);d=5e-3; % particle diameter (m)
U0=10e-3; % superficial velocity (m/s)
eps=0.47; % average porosity
Uavg=U0/eps; % average axial velocity (m/s)
C0=6; % inlet tracer concentration (mM)
cellsize=2.5e-4; % grid size (m)
nx=320; % number of cells in the x (axial) direction
ny=86; % number of cells in the y direction
nz=86; % number of cells in the z direction
L=nx*cellsize; % length of the column (m)
R=0.5*(ny-2)*cellsize; % radius of the column (m)
Ri=0.5e-3; % radius of the tracer tube (m)
flag=reshape(M(:,1),[nx,ny,nz]);Ux=reshape(M(:,2),[nx,ny,nz]);Uy=reshape(M(:,3),[nx,ny,nz]);Uz=reshape(M(:,4),[nx,ny,nz]);C=reshape(M(:,6),[nx,ny,nz]);N=29; % number of intervals
radp=1:N;radgrid=[0 radp];i=20; % index for the axial position
for m=1:N jcen=ny/2; kcen=nz/2; centerValue=C(i,jcen,kcen); r1=radgrid(m); conc=0; counter=0; for j=1:ny for k=1:nz r=sqrt((j-jcen)^2+(k-kcen)^2); r2=radgrid(m+1); if r>=r1 && r<=r2 && (flag(i,j,k)==0 || flag(i,j,k)==0.5) conc=conc+C(i,j,k); counter=counter+1; end end end radCprof(m)=conc/counter;endradCprof=[centerValue radCprof];radialpos=R*radp/max(radp);myArray=[0 radialpos];roots=30;z=i*cellsize;beta=besselzero(1,roots,1);value=0;for i=1:roots value=value+besselj(1,beta(i)*Ri/R)*besselj(0,beta(i)*r/R)/(beta(i)*(besselj(0,beta(i)))^2)*(z/R)*exp(-beta(i)^2*z/(PeT*R));endmodelfun=@(PeT,r)C0*(1+(2*R/Ri)*value);x=lsqcurvefit(modelfun,12,myArray,radCprof);
And I receive the following error when I launch it:
Undefined function or variable 'PeT'.
Error in TransverseDispersionBessel (line 70)
value=value+besselj(1,beta(i)*Ri/R)*besselj(0,beta(i)*r/R)/(beta(i)*(besselj(0,beta(i)))^2)*(z/R)*exp(-beta(i)^2*z/(PeT*R));
How could I solve this problem?
Best Answer