Too Many Input Arguments - I am new to matlab and not sure how to solve this

2 views (last 30 days)
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

Accepted Answer

Sam Chak
Sam Chak on 29 Jun 2022
Try fixing these lines
function dhdt = thesis(t, h)
dhdt = x1*(K1*t-(Vsto*fPr));
  3 Comments
Matthew Charles
Matthew Charles on 29 Jun 2022
I understand what you mean here, especially for the values derived for K1, I will review once more and ensure all the formulas for the function is indeed correct. Thank you so much for your assistance

Sign in to comment.

More Answers (1)

Saksham Gupta
Saksham Gupta on 29 Jun 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.
To explore more about ode45, you may refer the documentation

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!