Effacer les filtres
Effacer les filtres

numerical integration

2 vues (au cours des 30 derniers jours)
rahman
rahman le 15 Mai 2011
Hi all
I want to numerically integral a function with four variable(f(x,y,z,v)).how can I use dblquad?
  4 commentaires
Andrew Newell
Andrew Newell le 15 Mai 2011
Are your integral limits rectangular? e.g., xmin <= x <= xmax?
rahman
rahman le 15 Mai 2011
yes.all of four variables integration domain are limited.

Connectez-vous pour commenter.

Réponse acceptée

Andrew Newell
Andrew Newell le 15 Mai 2011
This turned out to be surprisingly tricky, but here is the solution. First, define a function
function fzv = integrateOverSecondPair(fun,x,y,zmin,zmax,vmin,vmax)
% DBLQUAD evaluates FUN for a vector x and scalar y. The backwards loop is
% Matt Fig's dynamic preallocation.
for ii=numel(x):-1:1
g = @(z,v) fun(x(ii),y,z,v);
fzv(ii) = dblquad(g,zmin,zmax,vmin,vmax);
end
Then use the commands
fzv = @(x,y) integrateOverSecondPair(@f,x,y,zmin,zmax,vmin,vmax);
fxyzv = dblquad(fzv,xmin,xmax,ymin,ymax);
  1 commentaire
rahman
rahman le 15 Mai 2011
tnx Andrew
That work excellent! ;)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by