Hello,
Looking for an efficient and succinct way to numerically calculate N Fourier coefficients with integrate().
For example, I can easily calculate a_k for k=1 as shown below, however I would like to succinctly calculate an array of a_k for k=1:N, without using a for loop.
k =1;fun = @(x) cos(k*x)./sin(x);a_k = integral(fun,x1,x2);
Any suggestions?
Cheers!
Edit: Sorry, I meant integral() function in the first sentence.
Best Answer