Fourier series fit to a periodic function with multiple frequencies
32 views (last 30 days)
I want to fit a Fourier series to a square wave functoin with two frequencies and varying amplitude. I have attached the graph for more clarification.
I can estimate the simple square wave with Fourier series. But the problem arises when I modify the amplitude of the wave with some other frequency. In the figure below, the square wave period is the same as blue function. But at some points the amplitudes are changing and the period of this part is different than the main period. Fourier series provides the average as DC part and cannot model this.
I would be grateful if you share with me your ideas on how to solve the problem.
Star Strider on 12 Aug 2022
Adding a second function will change the baseline, for example —
t = linspace(0, 10, 1000);
s = sum((1./[1;3;5]).*sin([1;3;5]*2*pi*t*0.5)) + 0.1*cos(2*pi*t*0.1);
It might be appropriate to use some sort of stepwise funciton rather than a continuous function, depending on the result you want.
Benjamin Thompson on 12 Aug 2022
Try looking over the documentation of the fft in MATLAB, along with the examples included there. If you have more specific questions and can post some of your work that you have a question about then post that to this board or add it to this questions.