I HAVE THE FOLLOWING ERROR: "Error using bvparguments" HELP ME TO FIX IT

Error using bvparguments (line 108)
Error in calling BVP4C(ODEFUN,BCFUN,SOLINIT):
The derivative function ODEFUN should return a column vector of length 8.
Error in bvp4c (line 122)
bvparguments(solver_name,ode,bc,solinit,options,varargin);
Error in second (line 25)
sol =bvp4c(@shootode,@shootbc,solinit);

8 Comments

You forget to specify an 8th equation in dydx.
Or you have 8 boundary where only 7 can be specified.
no i have 7 first order DE and 8 boundaries only that is my problem
Not solvable. The number of ODEs must be equal to the number of boundary conditions.
no sir this is the example which is in matlab tutorials
function mmbvp
%MMBVP Exercise for Example 7 of the BVP tutorial.
% This is the Michaelis-Menten kinetics problem solved in section 6.2 of
% H.B. Keller, Numerical Methods for Two-Point Boundary-Value Problems,
% Dover, New York, 1992, for parameters epsilon = 0.1 and k = 0.1.
% Known parameters
epsilon = 0.1;
k = 0.1;
d = 0.001;
options = bvpset('stats','on');
solinit = bvpinit(linspace(d,1,5),[0.01 0],0.01);
sol = bvp4c(@mmode,@mmbc,solinit,options,epsilon,k,d);
p = sol.parameters; % unknown parameter
xint = linspace(d,1);
Sxint = bvpval(sol,xint);
% Augment the solution array with the values y(0) = p, y'(0) = 0
% to get a solution on [0, 1]. For this problem the solution is
% flat near x = 0, but if it had been necessary for a smooth graph,
% other values in [0,d] could have been obtained from the series.
x = [0 xint];
y = [[p; 0] Sxint];
clf reset
plot(x,y(1,:))
title('Michaelis-Menten kinetics problem with coordinate singularity.')
shg
% --------------------------------------------------------------------------
function dydx = mmode(x,y,p,epsilon,k,d)
%MMODE ODE function for the exercise of Example 7 of the BVP tutorial.
% On the argument list the known parameters must follow the unknown one.
dydx = [ y(2)
-2*(y(2)/x) + y(1)/(epsilon*(y(1) + k)) ];
% --------------------------------------------------------------------------
function res = mmbc(ya,yb,p,epsilon,k,d)
%MMBC Boundary conditions for the exercise of Example 7 of the BVP tutorial.
% On the argument list the known parameters must follow the unknown one.
% The boundary conditions at x = d are that y and y' have values yatd and
% ypatd obtained from series expansions. The unknown parameter p = y(0)
% is used in the expansions. y''(d) also appears in the expansions.
% It is evaluated as a limit in the differential equation.
yp2atd = p /(3*epsilon*(p + k));
yatd = p + 0.5*yp2atd*d^2;
ypatd = yp2atd*d;
res = [ yb(1) - 1
ya(1) - yatd
ya(2) - ypatd ];
What is the mathematical set of equations that you're trying to solve? Post them as text or as LaTeX (using the equation editor tool, the Sigma sign in the Insert section of the toolbar) rather than posting as code.
yes sir are you there sir
my question is i have 7 derivative functions and 8 boundary conditions
In the code you posted above, there is a third free parameter p that is to be adjusted so that all three instead of only two boundary conditions can be satisfied. Your original problem - which you deleted for some resason - did not contain such a free parameter.

Sign in to comment.

 Accepted Answer

Jan
Jan on 30 Dec 2022
Moved: Jan on 30 Dec 2022
The code does not run.
  • linspace(0,infinity,40) - what is "infinity" and of course you cannot divide the interval [0, Infinity] into 40 steps.
  • The functions need trailing end statements if this is written in a single file.
  • You provide an initial value with 8 components, but as the error message tells clearly, shootode replies 7 elements only.

1 Comment

for infinity value is consider as 6 and i have 7equations and 8 boundaries that is my problem

Sign in to comment.

More Answers (1)

you do not initialize your global variables, so some of your calculations return empty

Products

Asked:

on 30 Dec 2022

Edited:

on 3 Jan 2023

Community Treasure Hunt

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

Start Hunting!