
Re: double integration. numerical integration
Posted:
May 30, 2012 10:35 AM


"Steven_Lord" <slord@mathworks.com> wrote in message <jq5829$bar$1@newscl01ah.mathworks.com>... > > > "prabhakaran m" <prabha.gahon@gmail.com> wrote in message > news:jq47qc$16c$1@newscl01ah.mathworks.com... > > i am trying to approximate this double integrable. > > A(l,n) = 1/(2*pi*L) int(0 , L) int ( 0, 2*pi ) w(x,y) cos( l*theta) cos( n > > pi x/L) dx dy > > If you have a function with which you can compute w(x, y), use INTEGRAL2 or > QUAD2D or DBLQUAD (depending on how old a version of MATLAB you're using.) > > If you don't know the form w(x, y) but you want A to be a function of w, try > INT from Symbolic Math Toolbox. Don't expect too much unless you can provide > it more information about w.
w(x,y) is a matrix of discrete data of size(22,73), where A(l,n) is the fourier coefficients i am trying to deduce. here is the modified code i have written first for integrals, int(0,2*pi) w(x,y)*cos(l*theta) dtheta . approximated by rectangular method
y=linspace(0,2*pi,73) NA=length(x); NC=length(y);
for i=1:NA for l=1:floor(NC/2) sum1=0; for j=1:NC y1=d(j,i)*cos((l1)*y(j)); sum1=sum1+y1; end F(i,l)=2*pi*sum1/NC; end end
and then doing for int(0,L) F(i,l) *cos(k*pi*l/NA) dl approximated by trapezoidal method
for L=1:floor(NC/2) for k = 1:floor(NA/2) sum1=0.5*(F1(1,L)+F1(NA,L))*cos(k*pi); for i = 2:NA1 arg=(k1)*pi*(i1)/NA; y11=F(i,L)*cos(arg); sum1=sum1+y11 end A(k,L)=2*sum1/(pi*(NA)); end end
is this approximation correct.

