How to solve first order differential condition with two initial conditions?

1 回表示 (過去 30 日間)
I G
I G 2020 年 2 月 27 日
コメント済み: darova 2020 年 2 月 27 日
I had system of equations defined in m file fun_zap_ri.m:
function [f, R] = fun_zap_ri(z, p, beta, ri)
R = ri - z .* (ri - 1);
f = zeros(4, size(p,2));
f(1,:) = - 32 .* beta ./ (R .^ 4 .* p(1,:));
f(2,:) = ( - 8 .* f(1,:) ./ R - f(1,:) .* p(2,:) ) ./ p(1,:);
f(3,:) = ( - p(2,:) .* f(2,:) - 8 .* f(2,:) ./ R - 8 .* f(1,:) ./ (R .* R .* p(1,:) ) - f(1,:) .* p(3,:) ) ./ p(1,:);
f(4,:) = ( - f(2,:) .* p(3,:) - f(3,:) .* p(2,:) + 8 .* ( - f(3,:) ./ R - ( f(2,:) ./ p(1,:) - p(2,:) .* f(1,:) ./ ( p(1,:) .* p(1,:) ) ) ./ (R .* R)) - f(1,:) .* p(4,:) ) ./ p(1,:);
where I solved it with call:
ri = 1;
beta = 1;
z = linspace(1,0,1001);
options = odeset('RelTol',1.e-6);
[~, pv] = ode45(@(z, p)fun_zap_ri(z, p, beta, ri), z, [1; 0; 0; 0], options);
The system given above I got from form of equation (I will give example just for the first equation)
p0 * p0' = - 32 * beta * m0 / R^4
where m0 = 1, than it can be concluded p0' = - 32 * beta * m0 / ( R^4 * p0)
I also have condition p0(z = 1) = 1 (exactly this is part of code given in [1; 0; 0; 0]). With all other given parameters, as z, ri, R, beta I can calculate p0 (or as given in my code pv) with ode45 call.
Now I have the same system p0 * p0' = - 32 * beta * m0 / R^4, but m0 is not given, but I have values for p0(z=0) = 8 and p0(z=1) = 1.
How I can solve this differential equation? Should I also give m0? Or is there some function in matlab which will solve equation with two "initial" conditions?

回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by