BVP4c Solving two equations simultaneously
    조회 수: 5 (최근 30일)
  
       이전 댓글 표시
    
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?
댓글 수: 1
  David Goodmanson
      
      
 2019년 1월 25일
				Hi Taylor,
If you start with (your original expression was a typo)
y'''' = A*y''+ y
and plug in y = V', you obtain a fifth order differential equation.  But now you have six boundary conditions,which appears to be one too many.
답변 (1개)
  Torsten
      
      
 2019년 1월 25일
        init = bvpinit(linspace(0,1,10),[0,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);
       y(1)];
end
function [ bc ] = bc_bvp( yl, yr)
bc = [yl(1) - hi; 
      yl(2);
      yr(1) - ho;
      yr(2)
      yl(5)];
  %or yr(5)-1.0];
end
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


