numerical integration

Hi all
I want to numerically integral a function with four variable(f(x,y,z,v)).how can I use dblquad?

댓글 수: 4

Andrew Newell
Andrew Newell 2011년 5월 15일
How many variables do you want to integrate over?
rahman
rahman 2011년 5월 15일
I want to integral over all of variables
Andrew Newell
Andrew Newell 2011년 5월 15일
Are your integral limits rectangular? e.g., xmin <= x <= xmax?
rahman
rahman 2011년 5월 15일
yes.all of four variables integration domain are limited.

댓글을 달려면 로그인하십시오.

 채택된 답변

Andrew Newell
Andrew Newell 2011년 5월 15일

0 개 추천

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

rahman
rahman 2011년 5월 15일
tnx Andrew
That work excellent! ;)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

질문:

2011년 5월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by