Solving ODE with boundary conditions
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Is there a way to solve the following ODE with the boundary conditions?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1223302/image.png)
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)
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!