Show stats in bvp4c
3 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Image Analyst
on 4 Sep 2021
Try adding more points to your x, like
numPoints = 1000;
x = linspace(0,1, numPoints);
0 Comments
See Also
Categories
Find more on Boundary Value Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!