Show stats in bvp4c
조회 수: 1 (최근 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!