フィルターのクリア

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

2 ビュー (過去 30 日間)
Sarah Nasra
Sarah Nasra 2021 年 11 月 22 日
コメント済み: Sarah Nasra 2021 年 11 月 22 日
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

回答 (1 件)

DGM
DGM 2021 年 11 月 22 日
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

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by