What determines the vector length that BCFUN should returns?

1 次查看(过去 30 天)
What determines the vector length that BCFUN should returns? Because i have this error in my code:
Error in calling BVP4C(ODEFUN,BCFUN,SOLINIT,P1,P2...): The boundary condition function BCFUN should return a column vector of length 2.
In the problem that i have to solve i need to satisfice 4 boundary conditions in a system of two equations. But matlab only allows me to have two. This is my code :
Main:
init=bvpinit(linspace(-10,0,10),@initEq5_7_);
sol=bvp4c(@rhsEq5_7,@bcEq5_7,init,[],c);
z=linspace(-10,0,100);
p=deval(sol,z);
hold on;
plot(z,p(1,:),'r--');
plot(z,p(2,:),'b');
---------------------
function v = initEq5_7_(x)
v = [ sin(x)
sin(x)];
-------------------------
function rhs=rhsEq5_7(x,y,c)
s=2;
mu=2;
k=1;
alpha=-(mu/(c^2-s^2));
beta=2*k/s;
rhs=[-alpha*y(1)*(c-s*(2*y(2)-1))
-beta*y(1)*(1-y(2))*y(2)];
---------------------------
function rhs=bcEq5_7(l,r,c)
ql=0.5;
qr=0.01;
rhs=[l(1)
r(1)
l(2)
r(2)
];
It doesn't make sense to me, because i have seen code with more boundary conditions than equations. Thanks in advance.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Signal Processing Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by