why does matlab give me a message that a never-used varible is undefined?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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;
0 Commenti
Risposta accettata
Walter Roberson
il 6 Ott 2011
'le' is the printable name of the function <=
You are computing a result symbolically and attempting to compare the result using <= to some other value.
If you are sure that the symbolic result is a symbolic number with no remaining symbolic variables, then use double() to convert the symbolic result to a double precision number so it can be compared. This will, however, not work if there are any symbolic variables remaining in the expression.
Più risposte (1)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!