Too Many Input Arguments - I am new to matlab and not sure how to solve this
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Matthew Charles
il 29 Giu 2022
Commentato: Matthew Charles
il 29 Giu 2022
function [h] = thesis(t)
% Oil/Brine Systems Main Characteristics
%% 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
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)
%% Sedimentation interface, hs: dhs/dt
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
delrho1 = rho_B2 - rho_O2; % difference between the dispersed water and continuous oil phase
Vsto = (delrho1*g*(D0^2))/18*mu2; % Settling Velocity of Hard Spheres (stoke's velocity)
fPr = (1-Pr0)^5.3; % Dimensionless
x1 = 60; % (hs - hd) in mm, guessed value
K1 = ((2/3)*alpha*((Vsto^2)/D0))*((fPr^2)/((Prm/fPr)^1/3)-1);
h = x1*(K1*t-(Vsto*fPr));
end
I tried everything to figure this out but dont understand what I can do again. Any assistance is greatly appreciated. thanks
0 Commenti
Risposta accettata
Sam Chak
il 29 Giu 2022
Try fixing these lines
function dhdt = thesis(t, h)
dhdt = x1*(K1*t-(Vsto*fPr));
3 Commenti
Sam Chak
il 29 Giu 2022
Modificato: Sam Chak
il 29 Giu 2022
If h is really the height of the column. and this line
dhdt = x1*(K1*t-(Vsto*fPr));
and its depending parameters correctly describe the differential equation (how h will change according to time t), then the following MATLAB code should give a result:
tspan = [0 180];
h0 = 240;
[t, h] = ode45(@thesis, tspan, h0);
plot(t, h)
If the result is incorrect (obvious because h exploded to ), something must be incorrect in your thesis function file. Please check at least x1, K1, Vsto, fPr.
x1 = 60; % (hs - hd) in mm, guessed value
K1 = ((2/3)*alpha*((Vsto^2)/D0))*((fPr^2)/((Prm/fPr)^1/3)-1)
At least, mathematically I understand if , then will explode.
Più risposte (1)
Saksham Gupta
il 29 Giu 2022
As per my understanding of your query, you are getting error in using function 'ode45'.
From the error logs, I can say that 'ode' function in ode45 is getting more arguments than the parameters defined for it.
Upon inspection of code, I realized that 'ode' is nothing but the function handle of 'thesis' function which you are passing.
Your function 'thesis' is expected to accept y0 (which you are passing as [240] to ode45).
If you change the very first line to:
function [h] = thesis (t, y0)
you can get the output.
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!