필터 지우기
필터 지우기

numerical integration

조회 수: 2 (최근 30일)
rahman
rahman 2011년 5월 15일
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일
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일
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개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by