how to solve the error "Not enough input arguments."
Show older comments
how to solve the error "Not enough input arguments."
i have saved file as fick.m
function dydt = Fick(t,C,V,Ji,Je,J2i,J2e,tmax,Cinit)
dydt = (Ji(t,C)-Je(t,C)+J2i(t,C)-J2e(t,C))./V;
end
below file as practical.m
%%One Compartmental Model
clear all
clf % comment out if you want to use the increment tool
% set parameter values
V = 500; % litres water
Cin = 0.2; % mg chemical per litre water
Qi = 50; % litres of water per day
Qe = Qi; % equal volume flow rate
Cinit = 0; % no chemical in tank at time 0
tmax = 30; % time range over which to solve model (days)
% solve the differential equation
sol = ode45(@Fick,[0 tmax],Cinit,[],V,Ji,Je,J2i,J2e);
tstep = 0.01;
tspan = 0:tstep:tmax;
y = deval(sol,tspan);
plot(tspan,y)
xlabel('time (days)');
ylabel('Concentration (mg/l)');
*but i am getting following error..*
Error using Fick (line 2)
Not enough input arguments.
3 Comments
Madipelli himani
on 16 Apr 2022
%unit step function
function [u]= unit_step (t) %Function definition
len=length(t);
for (i=1:1:len); %Conditional Loop
if (t(i)<0)
u(i)=0;
else
u(i)=1;
end
end
end
Madipelli himani
on 16 Apr 2022
iam getting this error Not enough input arguments.
Madipelli himani
on 16 Apr 2022
unit_step
Not enough input arguments.
Error in unit_step (line 4)
len=length(t);
Accepted Answer
More Answers (3)
mukul chankaya
on 8 Oct 2020
1 vote
Hi, good day everyone I am also getting "not enough input argument" While running
Function cost=optim_pi(k) Assignin ( 'base, 'k',k) ; sim('simulation model name') ; cost=ISE(length(ISE)) ; end ISE is integral square error to be optimization by GA Kindly reply
1 Comment
Sanket Kumar
on 7 Feb 2023
Have you got the solution??
Chapat
on 11 Mar 2020
0 votes
Hello! I am new in Matlab, I am having a problem in running this code with the function refraction_2layers (line 18) and line 25 The error message is not enough input arguments
Chapat
on 11 Mar 2020
function refraction_2layers(v1, v2, z, FIRST_ARRIVALS_ONLY);
% refraction_2layers(v1, v2, z); % % Creates travel time plots for a two-layers system with layer velocities % v1 and v2 and layer 1 thickness of z % The FIRST_ARRIVALS_ONLY FLAG may be set to 1 to plot only the first arrivals. By % default, all arrivals are plotted.
if nargin < 4 FIRST_ARRIVALS_ONLY = 0; end %% X-positions for geophones (m, relative to source) x = [0:5:300];
%% Direct wave %% Travels along ground surface (at velocity v1) t1 = x./v1;
%% Head wave %% Refracts along z1-z2 boundary %% Travel time depends on velocities of both layers %% and thickness of layer 1 only (thickness of layer 2 irrelevant)
t2 = (2*z*sqrt(v2^2-v1^2)/(v1*v2))+x./v2; %% Note slope should be 1/v2!
xcrit = 2*z*v1/(sqrt(v2^2-v1^2)); if isreal(xcrit) a = min(find(x>xcrit)); end
crossover = ((2*z*sqrt(v2^2-v1^2))/(v1*v2))/(1/v1-1/v2);
b = max(find(x<= crossover));
if FIRST_ARRIVALS_ONLY plot(x(1:b),t1(1:b)*1000, '.--') hold on if isreal(t2) plot(x(b:end), t2(b:end)*1000, 'r.--') end else plot(x,t1*1000, '.--') hold on if isreal(t2) plot(x(a:end), t2(a:end)*1000, 'r.--') end end
xlabel('GEOPHONE OFFSET (m)')
ylabel('TIME (ms)')
grid on
legend('DIRECT WAVE', 'HEAD WAVE')
title(['z1 = ', num2str(z), ' m; v1 = ', num2str(v1), ' m/s; v2 = ', num2str(v2), ' m/s'])
axis ([0 300 0 300])
hold off
Here is the program at line 18 and 25 I am having the not enough input arguments error
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!