1

我正在尝试使用拍摄方法解决 MATLAB 中的边界值问题。但是,当我尝试通过 fsolve 传递我的函数时,我收到如下警告:警告:在 t=-9.462647e+001 失败。如果不将步长减小到低于时间 t 允许的最小值 (2.273737e-013),则无法满足积分容差。

我尝试了一些常见的解决方法,例如使用不同的 ODE 求解器并更改 ODE 求解和 fsolve 中的容差,但无济于事。目前,当我对我的参数运行 fsolve 时,它​​没有任何改变,这与我最初的猜测相同。

我已经包含了主脚本文件的代码以及 fsolve 调用的函数文件。

%% Main file
% PARAMETERS
% propanol (fig2, curve3, p337) 
E=6.5; %2.5
K=0.0474;

% GUESSES
infinity=100; % numerical approximation of infinity
x=0; % expanded around x=0
x0=3;
B0=-2*10^(-8);
B1=0.01;
% Guess for P
P=-1+3*B0*(1-(E/(K+1)))*exp((x-x0)*sqrt(3*E/(K+1)));
% Guess for P'
PI=sqrt(3*E/(K+1))*3*B0*(1-(E/(K+1)))*exp((x-x0)*sqrt(3*E/(K+1)));
% Guess for H
H=1+B0*exp((x-x0)*sqrt(3*E/(K+1)))+B1*exp((x-x0)*sqrt(3));
% Guess for H' (contact angle in degrees)
HI=sqrt(3*E/(K+1))*B0*exp((x-x0)*sqrt(3*E/(K+1)))+sqrt(3)*B1*exp((x-x0)*sqrt(3));

% FUNCTION
f=@(t,x) [x(2); ...
    3*E*(1+x(1))/((1+K*x(3))*(x(3))^3) - 3*x(2) * x(4)/(x(3));...
    x(4);...
    -1/(x(3)^3) - x(1)];

% SHOOTING METHOD
tspan=[-infinity, infinity];
myguess=[P, PI, H, HI]; % initial guess for P', H'
[actualvalue, Fval, exitflag]=fsolve('shootingfunc_thin_100',myguess);
init=actualvalue; % new initial paramaters
[t,X]=ode45(f,tspan,init);

%% Function file
function [ f ] = shootingfunc_thin_100( a )
%shootingfunc_thin: Shooting from thin to thick
%   optimizes P=0 at infinity only
E=6.5;
K=0.0474;

fun=@(t,x) [x(2); ...
    3*E*(1+x(1))/((1+K*x(3))*(x(3))^3) - 3*x(2) * x(4)/(x(3));...
    x(4);...
    -1/(x(3)^3) - x(1)];

infinity=10^2;
tspan=[-infinity, infinity];
init=[-1 a(2) 1 a(4)]; % initial conditions at thin
%options=odeset('RelTol',1e-10); %'RelTol',1e-16
[t,x]=ode45(fun,tspan,init);
f=x(end,1);
end
4

0 回答 0