Show stats in bvp4c
3 ビュー (過去 30 日間)
古いコメントを表示
Hi, I would like to see the stats, like the number of iterations. I have 'Stats' 'on' but doesn't show anything.
Thanks for your help.
clc, clear, close all
lambda = 1;
fun = @(alpha)cosh(alpha)-4/sqrt(2*lambda)*alpha;
alpha = fzero(fun,1);
fun_exacta = @(x) 2*log(cosh(alpha)./cosh(alpha*(1-2*x)));
x = linspace(0,1);
y_exacta = fun_exacta(x);
figure(1), hold on
p3 = plot(x,y_exacta,'r','LineWidth',1.2);
x = linspace(0,1,5);
upr = @(t,u) [u(2) ; -lambda*exp(u(1))];
condcon = @(ua,ub) [ua(1)-0 ; ub(1)-0];
solinit = bvpinit(x,[0;0]);
options = bvpset('RelTol',1e-5,'Stats','on')
sol = bvp4c(upr,condcon,solinit)
x = linspace(0,1);
u = deval(sol,x,1);
p1 = plot(sol.x,sol.y(1,:),'b','LineWidth',1.2);
p2 = plot(x,u,'k--','LineWidth',1.2);
legend([p1 p2 p3],'Solución','deval','Exacta')
0 件のコメント
回答 (1 件)
Image Analyst
2021 年 9 月 4 日
Try adding more points to your x, like
numPoints = 1000;
x = linspace(0,1, numPoints);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Boundary Value Problems についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!