when i run my code i accept an Error: Not enough input arguments.
조회 수: 2 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
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)
% define a function
function out = myfunction(arg1,arg2)
out = arg1+arg2;
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!