From: Francesco Parisi on
Hi. I have some difficulties to set a "m" function (I've just written a variant of triplequad.m) . Its aim is to solve a quadruple integral. Unfortunately when I try to pass it a 4
variables function:

a=@(x,y,z,t) x+y+z+t;

A=quad4(a,0,1,0,2,0,3,0,4)

the script don't works:

function Q =
quad4(intfcn,xmin,xmax,ymin,ymax,zmin,zmax,tmin,tmax,tol,quadf,varargin)

if nargin < 9
error('MATLAB:quad4:NotEnoughInputs', '9 inputs at least please');
end
if nargin < 10 || isempty(tol), tol = 1.e-6; end
if nargin < 11 || isempty(quadf)
quadf = @quad;
else
quadf = fcnchk(quadf);
end
intfcn = fcnchk(intfcn);

Q = triplequad(@innerintegral, ymin, ymax, zmin, zmax, tmin, tmax,
tol, quadf, intfcn, ...
xmin, xmax, tol, quadf, varargin{:});

%---------------------------------------------------------------------------

function Q = innerintegral(y, z, t, intfcn, xmin, xmax, tol, quadf,
varargin)
%INNERINTEGRAL Used with QUAD4 to evaluate inner integral.
%
% Q = INNERINTEGRAL(Y,Z,T,INTFCN,XMIN,XMAX,TOL,QUADF)

% Evaluate the innermost integral at each value of the outer
variables.

fcl = intfcn(xmin, y(1), z(1), t(1), varargin{:});
Q = zeros(size(y), superiorfloat(fcl, xmax, y, z, t, varargin{:}));
trace = [];

for i = 1:length(y)
Q(i) = quadf(intfcn, xmin, xmax, tol, trace, y(i), z, t,
varargin{:});
end

can someone help me?
 | 
Pages: 1
Prev: quadruple integral function
Next: PCA