Borrar filtros
Borrar filtros

Error using quad2d

3 visualizaciones (últimos 30 días)
Deema42
Deema42 el 18 de Feb. de 2022
Comentada: Walter Roberson el 30 de Mayo de 2022
Hello everyone,
I am trying to run the function Bivariate_Meijer_G_Ask, with the command :
close all;clear
am1=[0]; bn1 =[1.2]; ap1 =[]; bq1 =[];
dn2 =[1 ,1]; cp2 =[]; cm2 =[1]; dq2 =[0];
fn3 =[]; ep3 =[0]; em3 =[1.2 ,2.3 ,3.4]; fq3 =[];
x =2; y =3;
Bivariate_Meijer_G_Ask(am1, ap1, bn1, bq1, cm2,cp2, dn2, dq2, em3, ep3, fn3, fq3, x, y)
However, I get the following error:
Error using quad2d (line 114)
C must be a finite, scalar, floating point constant or a function handle.
Error in Bivariate_Meijer_G_Ask (line 11)
out = (-1/(2.*pi)^2).*quad2d(F,cs-1j.*W,cs+1j.*W,
ct-1j.*W,ct+1j.*W,'Singular',true); %Increase MaxFunEvals for higher W
>Can someone please help me figure out this issue?
Thank you in advance!
function out = Bivariate_Meijer_G_Ask(am1, ap1, bn1, bq1, cm2,cp2, dn2, dq2, em3, ep3, fn3, fq3, x, y)
%***** Integrand definition *****
F = @(s,t) (GammaProd(am1,s+t) .* GammaProd(1-cm2,s).* GammaProd(dn2,-s) .* GammaProd(1-em3,t).* GammaProd(fn3,-t) .* (x.^s) .* (y.^t))./(GammaProd(1-ap1,-(s+t)) .* GammaProd(bq1, s+t) .* GammaProd(cp2,-s) .* GammaProd(1-dq2,s).* GammaProd(ep3,-t) .* GammaProd(1-fq3,t));
%***** Contour definition *****
Sups = min(dn2); Infs = -max(1-cm2); % cs
cs = (Sups + Infs)/2;% s between Sups and Infs
Supt = min(fn3); Inft = max([-am1-cs em3-1]);% t>-am1-s, s=cs
ct = Supt - ((Supt-Inft)/10);%t betweeen Supt and Inft
W = 10; % W
%***** Bivariate Meijer G *****
out = (-1/(2.*pi)^2).*quad2d(F,cs-1j.*W,cs+1j.*W, ct-1j.*W,ct+1j.*W,'Singular',true); %Increase MaxFunEvals for higher W
%***** GammaProd subfunction *****
function output = GammaProd(p,z)
[pp zz] = meshgrid(p,z);
if (isempty(p)) output = ones(size(z));
else output = reshape(prod(gamma(pp+zz),2),size(z));
end
end
end

Respuestas (1)

Walter Roberson
Walter Roberson el 18 de Feb. de 2022
Your fn3 is empty because you assign [] to it. Supt is min(fn3) but fn3 is empty so Supt is empty. ct is calculated based on Supt but Supt is empty so ct is empty. ct+1j.*W is empty because ct is empty. So the fourth parameter you pass to quad2d is empty.
am1=[0]; bn1 =[1.2]; ap1 =[]; bq1 =[];
dn2 =[1 ,1]; cp2 =[]; cm2 =[1]; dq2 =[0];
fn3 =[]; ep3 =[0]; em3 =[1.2 ,2.3 ,3.4]; fq3 =[];
x =2; y =3;
Bivariate_Meijer_G_Ask(am1, ap1, bn1, bq1, cm2,cp2, dn2, dq2, em3, ep3, fn3, fq3, x, y)
Name Size Bytes Class Attributes F 1x1 32 function_handle Infs 1x1 8 double Inft 1x1 8 double Sups 1x1 8 double Supt 0x0 0 double W 1x1 8 double am1 1x1 8 double ap1 0x0 0 double bn1 1x1 8 double bq1 0x0 0 double cm2 1x1 8 double cp2 0x0 0 double cs 1x1 8 double ct 0x0 0 double dn2 1x2 16 double dq2 1x1 8 double em3 1x3 24 double ep3 1x1 8 double fn3 0x0 0 double fq3 0x0 0 double x 1x1 8 double y 1x1 8 double
Error using quad2d (line 114)
C must be a finite, scalar, floating point constant or a function handle.

Error in solution>Bivariate_Meijer_G_Ask (line 21)
out = (-1/(2.*pi)^2).*quad2d(F,cs-1j.*W,cs+1j.*W, ct-1j.*W,ct+1j.*W,'Singular',true); %Increase MaxFunEvals for higher W
function out = Bivariate_Meijer_G_Ask(am1, ap1, bn1, bq1, cm2,cp2, dn2, dq2, em3, ep3, fn3, fq3, x, y)
%***** Integrand definition *****
F = @(s,t) (GammaProd(am1,s+t) .* GammaProd(1-cm2,s).* GammaProd(dn2,-s) .* GammaProd(1-em3,t).* GammaProd(fn3,-t) .* (x.^s) .* (y.^t))./(GammaProd(1-ap1,-(s+t)) .* GammaProd(bq1, s+t) .* GammaProd(cp2,-s) .* GammaProd(1-dq2,s).* GammaProd(ep3,-t) .* GammaProd(1-fq3,t));
%***** Contour definition *****
Sups = min(dn2); Infs = -max(1-cm2); % cs
cs = (Sups + Infs)/2;% s between Sups and Infs
Supt = min(fn3); Inft = max([-am1-cs em3-1]);% t>-am1-s, s=cs
ct = Supt - ((Supt-Inft)/10);%t betweeen Supt and Inft
W = 10; % W
%***** Bivariate Meijer G *****
whos
out = (-1/(2.*pi)^2).*quad2d(F,cs-1j.*W,cs+1j.*W, ct-1j.*W,ct+1j.*W,'Singular',true); %Increase MaxFunEvals for higher W
%***** GammaProd subfunction *****
function output = GammaProd(p,z)
[pp zz] = meshgrid(p,z);
if (isempty(p)) output = ones(size(z));
else output = reshape(prod(gamma(pp+zz),2),size(z));
end
end
end
  4 comentarios
Soumen Mondal
Soumen Mondal el 30 de Mayo de 2022
@Walter Roberson Can you provide a example for which the code is running.
Walter Roberson
Walter Roberson el 30 de Mayo de 2022
F = @(x,y) sin(x) + cos(y) - atan2(y,x)
F = function_handle with value:
@(x,y)sin(x)+cos(y)-atan2(y,x)
quad2d(F, -pi, 0, 0, pi)
ans = -29.5379

Iniciar sesión para comentar.

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Productos


Versión

R2017a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by