I am trying to solve 3rd order ode by RK45, but I did not get solution and plot, kindly fix my issues

1 次查看(过去 30 天)
clear all;
clc;
close all;
h1(1)=0; % initial condition
y(1)=1; % initial condition
z(1)=-1; % initial condition
we=4;
k=0.5;
n=0.2;
B=0.5;
pr=2;
sc=1.2;
L=0.5;
p=1; % h5 value
q=1; % h51 value
r=0.1; % h6 value
s=L.*r; % h7 value
a=0;
b=5;
m=100;
h=(b-a)/m;
x=a:h:b;
i=0;
nr1=(y.^2-h1*z-2*k*z*(1+we.^2*z^2).^((n-1)/2)-k*(n-1)*(1+we.^2*z^2).^((n-3)/2)+B*y);
dr1=(1+2*k*x).*(1+we.^2*z.^2).^((n-1)/2)+(n-1).*we.^2*z.^2.*(1+2*k*x).*((1+we.^2*z.^2).^(n-3)/2);
nr2=-2*k*p-(pr).*p*x;
dr2=1+2*k*x;
nr3=L.*r*(1-r).^2-s.*x-(2./sc).*k.*s;
dr3=1./sc;
f1=@(x,y,z) (nr1./dr1);
f2=@(x,p,q) (nr2./dr2);
f3=@(x,r,s) (nr3./dr3);
for i=i+1;
xx(i+1,:)=x;
%RK45
k1=h*f1(x,y(i));
k2=h*f1(x+h/4 , y(i)+(1/4)*k1);
k3=h*f1(x+(3*h/8),y(i)+(3/32)*k1+(9/32)*k2);
k4=h*f1(x+(12*h/13),y(i)+(1932/2197)*k1-(7200/2197)*k2+(7296/2197)*k3);
k5=h*f1(x+h,y(i)+(439/216)*k1-8*k2+(3680513)*k3-(845/4104)*k4);
k6=h*f1(x+0.5*h,y(i)-(8/27)*k1+2*k2-(3544/2565)*k3+(1859/4104)*k4-(11/40)*k5);
y(i+1,:)=(y(i,:)+((16/135)*k1+(6656/12825)*k3+(28561/56430)*k4-(9/50)*k5+(2/55)*k6));
erro(i+1,:)=((1/360)*k1-(128/4275)*k3+(2197/75240)*k4+(1/50)*k5+(2/55)*k6)*h;
end
Here I attached my ORIGINAL PROBLEM:

采纳的回答

James Tursa
James Tursa 2021-11-11
The image appears to show seven equations (H1', H2', ..., H7') with boundary conditions at 0 and infinity. The RK45 scheme you are using is for initial value problems, not boundary value problems. You need to use a different method.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by