Error in quad function-maximum function count exceeded. "Singularity likely" warning when I use the QUADL function in MATLAB
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all, I need help using the quadl function.
clear all close all clc format long gamma=1.4; r=10; n=1000; h =(r)/n; %h=0.01 M0=0.6; Pr=2/3; k1=1; k2=1.10; b1=0.375; b2=0.6; lambda=111.1532157006257798;
Integral_22= integral (@(x)((((1+(b1*(x.^2))).^((-k1)./(2*b1))).*((1+(b2*(x.^2))).^(k2./(2*b2)))).^lambda).*x,0,1);
for i=1:(n+1) x(i) = (i-0.5)*h ; end
for o=1:n
F1= @(x) ((((1+(b1*(x.^2))).^((-k1)./(2*b1))).*((1+(b2*(x.^2))).^(k2./(2*b2)))).^lambda).*x; Upper_Integral(o)= quadl(F1,0,x(o)); V(o)= Upper_Integral(o)./(x(o).*Integral_22); F2= @(x) ((-lambda).*(((k1*x)./(1+(b1*(x.^2))))-((k2*x)./(1+(b2*(x.^2)))))); U(o)=F2(x(o)); F3= @(x)((((1+(b1*(x.^2))).^((-k1)./(2*b1))).*((1+(b2*(x.^2))).^(k2./(2*b2)))).^lambda); F4= @(x) ((((1+(b1*(x.^2))).^((-k1)./(2*b1))).*((1+(b2*(x.^2))).^(k2./(2*b2)))).^lambda).*x; Upper_Integral2(o)= quadl(F4,0,x(o)); F5(o)= -((2./(x(o)).^2).*Upper_Integral2(o)); F6(o)=F3(x(o)); f(o)=((1./Integral_22).*(F5(o)+F6(o))).^2; w=@(x)(((((1+(b1*(x.^2))).^(((Pr)*k1)./(2*b1)))./((1+(b2*(x.^2))).^(((Pr)*k2)./(2*b2)))).^lambda).*((U(o).*(V(o).^2))+(x.*f(o)))); Integral(o)=quad(w,0,x(o)); d_Theta=@(x) (-(((((1+(b2*(x.^2))).^(((Pr)*k2)./(2*b2)))./((((1+(b1*(x.^2))).^(((Pr)*k1)./(2*b1)))))).^lambda).*(1/x).*Integral(o).*((M0.^2).*(Pr).*(gamma-1)))); F9(o)=d_Theta(x(o));
end
- Warning: Maximum function count exceeded; singularity likely. > In quad at 99 *
I think that the problem is at the line Integral(o)=quad(w,0,x(o));
Anyone can help please?
0 comentarios
Respuestas (1)
Mike Hosea
el 30 de Sept. de 2014
Is there some important reason why you are using INTEGRAL, QUAD, and QUADL, all three? QUAD and QUADL are deprecated. Use INTEGRAL for every case. Literally just substitute "integral" for "quad" and "quadl". INTEGRAL can even handle mild endpoint singularities, which QUAD and QUADL cannot. I tried it on your problem and there were no problems.
Ver también
Categorías
Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!