What determines the vector length that BCFUN should returns?

조회 수: 2 (최근 30일)
Jules
Jules 2013년 9월 4일
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