Too many input arguments while solving BVP using bvp4c
Afficher commentaires plus anciens
Hello, I am trying to run the following chunk of code, which integrates a system of 11 ODEs with an eigenvalue to be fixed. I get a 'too many arguments' error on calling the function bvp_RHS(). I don't get why:
phif = 0.1; % total length
phit = 0.05;
alpha = 0.3;
C_init = 1e-2;
solinit = bvpinit(linspace(-phif/2, phif/2, 10), @(x)mat4init(x, phif), C_init);
options = bvpset('Stats','on','RelTol',1e-5);
sol = bvp4c(@bvp_RHS, @(yL,yR)bvp_BC(yL, yR, phit, alpha), solinit, options);
%-------------------------------------------------------------------------
function yinit = mat4init(x, phif)
yinit = [cos(pi/phif*x)
-pi/phif * sin(pi/phif*x)
0.1
0.1
0.1
-0.1
0.1
0
0
0
0
];
end
function dyds = bvp_RHS(y,C)
% Total 2+9=11 variables.
dyds = [ y(2)
-0.5*y(1)^3 - C*y(1) % -0.5*kappa^3 - C*kappa
y(6) % =tx
y(7) % =ty
y(8) % =tz
-y(3) + y(1)*y(9) % =-rx + kappa*nx
-y(4) + y(1)*y(10) % =-ry + kappa*ny
-y(5) + y(1)*y(11) % =-rz + kappa*nz
-y(1)*y(6) % =-kappa*tx
-y(1)*y(7) % =-kappa*ty
-y(1)*y(8) % =-kappa*tz
];
end
%-------------------------------------------------------------------------
function res = bvp_BC(yL, yR, phit, alpha)
% BCs at L and R boundaries, with constraint for eigenvalue C.
% Symmetrised BCs for r and t, so that L and R are at \pm phit/2.
res = [ yL(1)
yR(1)
yL(3)-cos(phit/2) % fix position: rx
yL(4)+sin(phit/2) % fix position: ry
yL(5) % fix position: rz
yR(3)-cos(phit/2) % fix position: rx
yR(4)-sin(phit/2) % fix position: ry
yR(5) % fix position: rz
yL(6)-sin(phit/2)*cos(alpha) % fix slope: tx
yL(7)-cos(phit/2)*cos(alpha) % fix slope: ty
yL(8)-sin(alpha) % fix slope: tz
yR(6)-sin(phit/2)*cos(alpha) % fix slope: tx
];
end
Could someone please advise?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
