Fourier series fit to a periodic function with multiple frequencies
23 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone,
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.
Best,
Behrang
2 comentarios
Paul
el 12 de Ag. de 2022
Hi Behrang,
As always, it's better to post some code and data that illustrates the problem.
Also, can you clarify the problem itself? It sounds like you wish to find the Fourier series of a signal that is expressed as the sum of two other signals. Is that correct?
Can the signal (i guess the blue curve?) be expressed as the sum of two, periodic square waves?
If so, have you verified that that signal (blue) is also periodic?
Behrang Hoseini
el 22 de Ag. de 2022
Editada: Behrang Hoseini
el 22 de Ag. de 2022
Respuestas (2)
Star Strider
el 12 de Ag. de 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);
figure
plot(t,s)
grid
It might be appropriate to use some sort of stepwise funciton rather than a continuous function, depending on the result you want.
.
14 comentarios
Benjamin Thompson
el 12 de Ag. de 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.
3 comentarios
Benjamin Thompson
el 22 de Ag. de 2022
If you plot the FFT result, you will see there are many harmonics needed to approximate both the square wave part and the odd change amplitude or bias. So two frequencies added together will not approximate your signal very well.
f = fs*(0:(n/2 - 1))/n;
fft_kt = abs(fft(k_t)/n);
figure, plot(f, fft_kt(1:n/2)), grid on, zoom on
Ver también
Categorías
Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!