ODE15s solver
조회 수: 1 (최근 30일)
이전 댓글 표시
%ODE15s function function F = oden(t,ys) % F is same as dudt, U = ys(1:N,1);
% Boundary
U(1)=0;
U(N)=1;
F(1,1)=beta*((U(2)-2*U(1))/dx/dx)+alpha*(U(2)/(2*dx));
F(2:N-1,1) = beta*((U(3:N)-2*U(2:N-1)+U(1:N-2))/dx/dx)+alpha*((U(3:N)-U(1:N-2))/(2*dx));
F(N,1)=beta*((1-2*U(N)+U(N-1))/dx/dx)+alpha*((1-U(N-1))/(2*dx));
end
end
This is my ODE15s solver for a finite difference for diffusion and convection, could someone tell what is wrong with this formula, because I keep not getting what I hoped for, which is a striaght line. The ghost point for 0 and N+1 is the same as 1 and N. Thank you.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!