Why am I getting this error? Error using feval Unrecognized function or variable 'emul'
조회 수: 19 (최근 30일)
이전 댓글 표시
%% Oil/Water System at 30C (Paraffin)
mu1 = 3.8; % Viscosity in mPa.s-1
rho_O1 = 797; % Oil Density in kg/m3
rho_B1 = 998; % Brine Density in kg/m3
IFT1 = 21; % Interfacial Tension mN/m
g = 9.81; % m2/s
% Concentration for this system is 80ppm
%% Oil/Water System at 40C (Crude Oil A)
mu2 = 5; % Viscosity in mPa.s-1
rho_O2 = 833; % Oil Density in kg/m3
rho_B2 = 994; % Brine Density in kg/m3
IFT2 = 5; % Interfacial Tension mN/m
% Concentration for this system is 200ppm
%% Oil/Water System at 50C (Crude Oil B)
mu3 = 6; % Viscosity in mPa.s-1
rho_O3 = 834; % Oil Density in kg/m3
rho_B3 = 989; % Brine Density in kg/m3
IFT3 = 3; % Interfacial Tension mN/m
% Concentration for this system is 200ppm
%% Oil/Water System at 60C (Crude Oil C)
mu4 =4.9; % Viscosity in mPa.s-1
rho_O4 = 826; % Oil Density in kg/m3
rho_B4 = 985; % Brine Density in kg/m3
IFT4 = 1; % Interfacial Tension mN/m
%Concentration for this system is 200ppm
function dh_s = emul(t,hs)
nd = 1000; % No. of Droplets
Vol = 900; % Liquid volume of emulsion (ml)
l = 0.5; % Mean Distance between droplets
alpha = 0.08; % Empirical Collision Effiency Parameter
D0 = 300; % Initial Droplet Diameter (microns)
Pr = 0.74; % Volume Fraction
Pr0 = ((nd*pi*D0^3)/6)/Vol; % Initial Volume Fraction of droplet
Prm = ((nd*pi*((D0+l)^3))/6)/Vol; % Maximum Volume Fraction of droplet
delrho = rho_B1 - rho_O1; % difference between the dispersed water and continuous oil phase
Vsto = (delrho*g*(D0^2))/18*mu1; % Settling Velocity of Hard Spheres (stoke's velocity)
fPr = (1-Pr0)^5.3; % Dimensionless
%D = sqrt((2/3)*alpha*((Vsto*fPr)/(((Prm/Pr0)^1/3)-1))*(D0*t)+(D0^2)); % evolution of average diameter versus time
K1 = ((2/3)*alpha*((Vsto^2)/D0))*((fPr^2)/((Prm/Pr)^1/3)-1);
dh_s = -K1*t-(Vsto*fPr);
end
답변 (2개)
Walter Roberson
2022년 3월 7일
When you use a quoted string as the routine to invoke, then remember that the string will be interpreted inside a function several levels down in the ode* routine. That function has no way of climbing up the chain of calls looking for private functions with the given name.
Because of this, when you use a quoted string as the routine to invoke, the name you give must be that of a public routine — a routine must have its own .m or .p or .mdl or .slx file (or be built in).
This restriction only applies when you use a quoted string for the routine. If you use @ and the name of a private routine then that would work (provided the routine is in scope.)
Moral of the story is to not use quoted strings as the routine name.
Image Analyst
2022년 3월 8일
You should not have a file noik.m and have this be the first line of code:
function dh_s = emul(t,hs)
You should call that emul.m. Then your noik code should call emul inside of it. emul.m should be in the current folder or on the serach path.
What does this say
>> which -all emul
댓글 수: 2
Steven Lord
2022년 3월 8일
Move the constants you define in the file with the emul function into the emul function itself. Make sure the first executable line of that file is the line:
function dh_s = emul(t,hs)
You may have comments before that line, but no executable code before that function line. Save this file as emul.m. Now run your ode45 call as before.
참고 항목
카테고리
Help Center 및 File Exchange에서 Electrophysiology에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!