Find a formula for the first harmonic
Show older comments
The procedure. We have a time-series (N last terms) x(1:N). Find Discrete Fourier Transfom h(1:N) = DFT(x). Find the Inverse DFT for the first harmonic (h(2) and h(N)) y(1:N). How to find a formula for the last term y(N)? I use the Symbolic Math TB:
syms N n x(n) k
h_term(n) = x(n) * exp(-2i*pi*(k-1)*(n-1)/N);
h(k) = symsum(h_term,n,1,N);
%h(2)
%h(N)
%y_term(k) = h(k) * exp(2i*pi*(k-1)*(n-1)/N);
yLast = (h(2) * exp(2i*pi*(N-1)/N) + h(N) * exp(2i*pi*(N-1)*(N-1)/N)) / N;
The formula contains i(=sqrt(-1)) but signals x and y are real. I need a simple formula for programming in C++ without complex numbers and expressions. How to find a simple formula with only sin & cos?
Answers (0)
Categories
Find more on Discrete Fourier and Cosine Transforms in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!