0
$\begingroup$

Say for example I have an 4th order ODE

y''' = A*y''+y

on the boundary [0 1] with the BC

y(0) = 1; y'(0) = 0; y(1) = 2; y'(1) = 0

I have my code setup like this.

init = bvpinit(linspace(0,1,10),[0,0,0,0]);
sol = bvp4c(@rhs_bvp, @bc_bvp, init);
x1 = linspace(0,1,100);
BS = deval(sol, x1);

function [ rhs ] = rhs_bvp( x, y )
A = 10;
rhs = [y(2); 
       y(3);
       y(4);
       A*y(3)+y(1)];
end

function [ bc ] = bc_bvp( yl, yr)
bc = [yl(1) - hi; 
      yl(2);
      yr(1) - ho;
      yr(2)];
end

Now Say I want to add another equation to solve simultaneously

V' = y

on the same boundary with BC

V(0) = 0; V(1) = 1

How would I go about including this new equation into this solver?

$\endgroup$
  • $\begingroup$ You can simply add a fifth variable y(5) which takes the role of V. From the ODE you obtain one additional entry in the vector rhs and from the boundary conditions you obtain two additional entries in the vector bc. $\endgroup$ – Christoph Jan 24 at 5:21
  • 2
    $\begingroup$ Is the equation supposed to be $y'''' = Ay'' + y$? $\endgroup$ – Dylan Jan 24 at 7:03
  • $\begingroup$ No, that is not possible. The number of boundary conditions has always to be equal to the dimension of the state. If you make the parameter $A$ variable, it adds a state dimension, so that you could have these 6 BC. $\endgroup$ – LutzL Jan 24 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.