Azzera filtri
Azzera filtri

when i run my code i accept an Error: Not enough input arguments.

2 visualizzazioni (ultimi 30 giorni)
i wrote my code and i think its true, but i accept an Error: "Not enough input arguments." and then another error that appears in the pic that i loaded.
the error its about the argument xmesh, but when i but this argument in the command window i dont accept an error!!! so i want help to understand whats wrong.
%Solve BVP
function [C] = morphogenes_diffusion_numeric(k,D,boundries,bound_con,Vmax)
xmesh = linspace(boundries(1),boundries(2));
init_guess = bvpinit(xmesh,@guess);
C = bvp4c(@(x,C) ode(C,k,D,Vmax), @(Ca,Cb) bouncon(Ca,Cb,bound_con), init_guess);
end
%Code Equation
function dCdx = ode(C,k,D,Vmax)
dCdx = [C(2)
C(1)*Vmax/(D*(k+C(1)))];
end
%Code Boundary Conditions
function bc = bouncon(Ca,Cb,bound_con)
bc = [Ca(1)-bound_con(1)
Cb(1)-bound_con(2)];
end
%Initial Guess
function g = guess(x)
g = [exp(x)+exp(-x)
exp(x)-exp(-x)];
end

Risposte (1)

DGM
DGM il 22 Nov 2021
You need to actually call your function with input arguments. If no arguments are provided, an error will occur on the first line where one of the missing arguments is required. That's why it's throwing the error on the xmesh() line.
% call the function with the required inputs
myanswer = myfunction(12,34)
myanswer = 46
% define a function
function out = myfunction(arg1,arg2)
out = arg1+arg2;
end

Categorie

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

Tag

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by