Too many input arguments.

2 visualizzazioni (ultimi 30 giorni)
Matthew Charles
Matthew Charles il 11 Lug 2022
Commentato: Matthew Charles il 12 Lug 2022
Hi everyone, I tried to generate a figure but got the above. Can someone show me where I could have gone wrong
function f = emu(t, x, nd, alpha, mu, D0, Vol, g, D)
hs = x(1);
D = x(2);
lambda = 1;
% xx = (hd-hw);
% if xx <= 0
% lambda = 0;
% end
theta_0 = nd*pi*D^3 /(6*Vol);
theta_m = nd*pi*(D+L)^3 /(6*Vol);
ftheta_0 = (1 - theta_0)^5.3;
Delta_rho = rho_B - rho_O;
Vst0 = Delta_rho*g*D0^2 /(18*mu);
K1 = abs((2/3)*alpha*Vst0^2 *ftheta_0^2 /(D0 * ((theta_m/theta_0)^(1/3)-1)));
D = sqrt((abs((2/3)*alpha*Vst0*ftheta_0/((theta_m/theta_0)^(1/3)-1)*D0*t +D0^2)));
dhs = lambda*(K1*t + Vst0*ftheta_0);
%dD = lambda*alpha/3 *(Vst0*ftheta_0)/((theta_m/theta_0)^(1/3) - 1) *D0/D;
f = [dhs;dD];
end
Code to generate figure:
clc, clear all, close all
%% Oil/Water System at 30C (Paraffin)
Vol = 900; % Volume for emulsion injected
g = 9810; % mm/s^2 - gravity
L = 0.5e-6; % distance between the surfaces of neighboring bubbles (guessed value)
nd = 1000; % guessed value for no. of bubbles
mu = 3.8; % Viscosity in mPa.s-1
rho_O = 7.97*10^-9; % Oil Density in kg/mm3
rho_B = 9.98*10^-9; % Brine Density in kg/mm3
sigma =21e-3; % Interfacial Tension mN/mm
theta_d = 0.74;
alpha = 0.08;
% Concentration for this system is 200ppm
%mu = 3.8e-3; % Viscosity mPa/s
D0 = 0.3; % converted 300um
H = 225; % in millimeters - initial height
% H = 225e-3;
tspan = [0 180];
hs0 = H;
x0 = [hs0, D0];
[t,x] = ode45(@(t,x)emu(t, x, nd, alpha, mu, sigma, D0, Vol, g, L), tspan, x0);
% plotting graph
figure
plot (t, real(x(:,1)), '-o')
hold on
plot(t, imag(x(:,1)))
hold off
grid on
ylabel ('H(mm)')
xlabel ('Time (s)')
set(gca, 'YScale','log')
title ('Simulation of Sedimentation-Coalesence Experiment')
Command Window Results:
Error using emu
Too many input arguments.
Error in fig>@(t,x)emu(t,x,nd,alpha,mu,sigma,D0,Vol,g,L) (line 30)
[t,x] = ode45(@(t,x)emu(t, x, nd, alpha, mu, sigma, D0, Vol, g, L), tspan, x0);
Error in odearguments (line 92)
f0 = ode(t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 107)
odearguments(odeIsFuncHandle,odeTreatAsMFile, solver_name, ode, tspan, y0, options, varargin);
Error in fig (line 30)
[t,x] = ode45(@(t,x)emu(t, x, nd, alpha, mu, sigma, D0, Vol, g, L), tspan, x0);

Risposta accettata

Torsten
Torsten il 11 Lug 2022
emu has 9 input parameters, but you call it with 10.
9 inputs: function f = emu(t, x, nd, alpha, mu, D0, Vol, g, D)
10 inputs assumed: [t,x] = ode45(@(t,x)emu(t, x, nd, alpha, mu, sigma, D0, Vol, g, L), tspan, x0);

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by