필터 지우기
필터 지우기

Solving ODE with boundary conditions

조회 수: 9 (최근 30일)
Delika Weragoda
Delika Weragoda 2022년 12월 7일
편집: Torsten 2022년 12월 7일
Is there a way to solve the following ODE with the boundary conditions?
All other parameters A, B, C, D and n are constants.
I tried using bvp4c, but I get an error for incorrect dimensions for raising a matrix power. Did convert all raising power and operation (* and /) using the elementwise operation, but still am unable to get a numerical solution. Would appreciate some guidance. The code I used is given below
Not sure if this is the way to solve this type of ode, if there are alternative ways to get a numerical solution that would be great.
Many thanks
------------------------------------------------------------------------------------------------------------
clc;
clear;
close all;
A = 6.14e-4;
B = -9.4e3;
C = 2.14;
D = 6.72e3
n = 3
yf = 0.3; %Y upper limit
%s0 = 1 - ((C/D)^(1/(n+1))); %calculate the initial values for y = 0
H = ((C/D)^(1/(n+1))) %Function to be subtracted above, for BC at y=0
f = @(y, s) ((A*y + B*s^n)/(n*C + D*(1-s)^(n+1)))*(((1-s)^(n+1))/s^n) %Subjected ds/dy from the above equation
%and simplied
bc = @(ya, yb) [ya(1) - 1 +H; yb(1)];%BC specified for S(0) = 1+H and S(y_f)=0)
ymesh = (0:0.005:yf)
solinit = bvpinit(ymesh, [1 0])
sol = bvp4c(f,bc, solinit)
plot(sol.r, sol.s)

답변 (1개)

Torsten
Torsten 2022년 12월 7일
편집: Torsten 2022년 12월 7일
You have a first-order ODE.
For first-order ODEs, you can prescribe one boundary condition, not two.
Or one of the parameters in the ODE is unknown and to be adjusted for that S satisfies the second boundary condition.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by