MATLAB Fourier coeffs of a function in Matlab

Click For Summary
The discussion centers on finding Fourier coefficients for a harmonic function represented as a product of cosine terms. The user seeks assistance with two main issues: first, generating a function of variables in MATLAB to facilitate updates as they multiply the function by additional cosine terms; second, identifying a command in MATLAB to compute the nth Fourier coefficient of a function rather than a vector. Suggestions include evaluating the function at a finely spaced vector of points and using the Fast Fourier Transform (FFT) to extract the coefficients, emphasizing that the real part of the FFT output will yield the desired results.
Alexandr
Messages
3
Reaction score
0
Please, people, need help!

I have a harmonic function which is a product of cosines (something with many cos(k*phi)) and it can be represented as a finite series with only cos terms... We know it...

Now. Every step we multiply this function by one more cos and want to find the Fourier coefs.

So, I don't understand two things...
1. There is no any method in Matlab to generate functions of variables as I understand... So, how can I provide this updating? I need that function of phi...
2. Is there any command for finding nth Fourier coefficient of function, not a vector?

Any useful tips?
 
Physics news on Phys.org
If you can write the function, set a vector of points x where the delta is very small, evaluate the function then take the FFT, the coefficients should pop right out as the real part.
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
7K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
3
Views
1K