"Steven_Lord" <email@example.com> wrote in message <firstname.lastname@example.org>... > > > "prabhakaran m" <email@example.com> wrote in message > news:firstname.lastname@example.org... > > 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((l-1)*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:NA-1 arg=(k-1)*pi*(i-1)/NA; y11=F(i,L)*cos(arg); sum1=sum1+y11 end A(k,L)=2*sum1/(pi*(NA)); end end