How to find Fourier series for the periodic function?
9 views (last 30 days)
Show older comments
Hello, I need to find the the Fourier series for the periodic function f(t) = 0 for -pi < t <= 0, and f(t) = t for 0 < t <= pi, and f(t) = f(t + 2pi). I can do the calculation by hand, but I want to ask if Matlab can help me solve this problem. If yes, could you provide me some instruction of how to write codes into Matlab to get the series that I want? Thank you so much!
p/s: This question has nothing to do with my homework, I just simply want to know if Matlab can help me solve this kind of problem so that I can save a lot of time and increase the accurateness of my answer if I encounter this type of problem in the future.
4 Comments
Torsten
on 11 Jan 2023
You don't need to write down the coefficients. You need to write down the formula by which the coefficients are computed.
Don't you have a textbook which states
a_i = 1/pi * integral_{t=-pi}^{t=pi} f(t) * cos(i*t) dt
b_i = 1/pi * integral_{t=-pi}^{t=pi} f(t) * sin(i*t) dt
?
You can compute the values for these integrals using MATLAB's "int".
Or you go the "lazy way" Matt J suggested in his answer. I did not yet know of this MATLAB function.
Accepted Answer
Matt J
on 11 Jan 2023
Edited: Matt J
on 11 Jan 2023
syms x n T
f=rectangularPulse(x);
series = simplify( fourier(f,2*pi*n/T)/T )
5 Comments
Matt J
on 11 Jan 2023
I think rather than series(0)=1 it should be 1/T.
syms x n T
f=rectangularPulse(x);
series(n) = simplify( fourier(f,2*pi*n/T)/T );
a0=limit(series(n),n,0)
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
