why does matlab give me a message that a never-used varible is undefined?
Show older comments
The first part is the main M file, the second part is a function M file. When it is run, a message "Undefined function or method 'le' for input arguments of type 'sym' ". But the variable le is never used in the code. I don't know why. I will appreciate if anyone can help.
MeanShearstress=5 ; %unit Pa
Density=1e3;
Ustar=sqrt(MeanShearstress/Density);
KinematicViscosity=1.004e-6;
D50=60e-6;
Roughness=2*D50;
RoughnessRenolds=Ustar*Roughness/KinematicViscosity;
CoefficientC=-0.993*log(RoughnessRenolds)+12.36;
Di=60e-6;
Protrusion=20e-6;
[MeanBedVelocity,Yb,Cd, Cl]=ProtrusionAssembly(Protrusion,Ustar,CoefficientC,D50,Di,KinematicViscosity);
function [MeanBedVelocity,Yb,Cd, Cl]=ProtrusionAssembly(Protrusion,Ustar,CoefficientC,D50,Di,KinematicViscosity)
Thickness=1.5*D50;
Y1=0.25*Thickness;
Y2=0.25*Thickness+Protrusion;
syms y;
Kapa=0.4;
MeanBedVelocity=(int((Ustar*CoefficientC*y/Thickness)*sqrt((0.5*Di)^2-(y-Protrusion-Y1+0.5*Di)^2),y,Y1,Thickness)...
+int((Ustar*(CoefficientC+log(y/Thickness)/Kapa))*sqrt((0.5*Di)^2-(y-Protrusion-Y1+0.5*Di)^2),y,Thickness,Y2))/(int(sqrt((0.5*Di)^2-(y-Protrusion-Y1+0.5*Di)^2),y,Y1,Y2));
if MeanBedVelocity<=Ustar*CoefficientC
Yb=(MeanBedVelocity*Thickness)/(Ustar*CoefficientC);
else
Yb=Thickness*exp(Kapa*(MeanBedVelocity/Ustar-CoefficientC));
end;
ParticleRenolds=MeanBedVelocity*Protrusion/KinematicViscosity;
if ParticleRenolds<=1754
Cd=(24/ParticleRenolds)*(1+0.15*ParticleRenolds^0.687);
else
Cd=0.36;
end;
if ParticleRenolds<8000
Cl=Cd;
end;
Accepted Answer
More Answers (1)
Lin LI
on 6 Oct 2011
0 votes
Categories
Find more on Symbolic Variables, Expressions, Functions, and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!