# Thread Subject: help with double integration

 Subject: help with double integration From: prabhakaran m Date: 29 Mar, 2012 01:26:18 Message: 1 of 5 need help to solve double integration. i have to calculate the fourier constant using the formula. A(m,n)= double integration of w(x,y)*cos(m*y/r)*cos(2*n*pi*x/L)in the limits(0,L,0,2*pi*R) i have the matrix w(x,y) of size 74*17 and A will also be in the size of 74*17. but i am puzzled with the number of for loops i have to use. here m and n in the formula is also constants m form 1 to 74 and n form 1 to 17. R is radius. L is the length. been puzzled here. the code below out = integrnd(x,y); A(m,n)= w(x,y)*cos(m*y/r)*cos(2*n*pi*x/l); result = dblquad(@integrnd,0,l,0,2*pi*R); i know there is big mistake in the code. by seeing the double integration help file, i have did the above part. if somebody helps me with the loops it will be of great help.
 Subject: help with double integration From: prabhakaran m Date: 29 Mar, 2012 02:24:28 Message: 2 of 5 x=linespace(0,L,16); y=linespace(0,2*pi*R,72)        for ii=1:length(x)   for jj=1:length(y)     const=0.0; for m=1:16     for n=1:74         I_term=w(ii,jj)*cos((n-1)*theta(ii))*cos(2*(m-1)*pi*v(jj)/h);         const=const+I_term;     end end result(m,n)=const; end end           I2 = trapz(y,trapz(x,result)) working around the clock i have did upto this. here I2 should also be in the array size of (14,74) but i am getting the error like this ??? Error using ==> trapz LENGTH(X) must equal the length of the first non-singleton dimension of Y. what might be the problem
 Subject: help with double integration From: prabhakaran m Date: 29 Mar, 2012 02:52:22 Message: 3 of 5 "prabhakaran m" wrote in message ... >  sorry typo error in above message the I2 array shd be in the size of same as w(i,j) otherwise ignore the above message. look at this L=150; R=(94.6/2+.5); %reference radius x=0:10:150; y=0:5:360;        for ii=1:length(x)   for jj=1:length(y)     const=0.0; for m=1:72     for n=1:15         I_term=w(ii,jj)*cos((m-1)*y(jj)/R)*cos(2*(n-1)*pi*x(ii)/L);         const=const+I_term;     end end result(ii,jj)=const; end end if i execute upto here i am getting Index exceeds matrix dimensions this error i know i have just misplaced the i, j , ii and jj. any help with that will be very helpful. after that i have to calculate I2 which is  I2 = trapz(y,trapz(x,result)) > sorry for repeated post. couldnt deny it.

### Everyone's Tags:

Separated by commas
Ex.: root locus, bode

### What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.