fourier series for function and period

3 views (last 30 days)
hi, trying to calculate the fourier series expansion in the period -3<t<3
f(t)={2, -3<t<0; {0, 0<t<3.
any help would be appreciated.

Accepted Answer

Star Strider
Star Strider on 4 May 2014
Edited: Star Strider on 4 May 2014
You can actually do this by hand quite easily. Using the Symbolic Math Toolbox to do the same thing:
syms t w
f1 = 2;
f1_lims = [-3 0];
f2 = 0;
f2_lims = [0 3];
% Integrate to get the Fourier series for ‘f1’:
F1 = int(exp(-j*w*t) * f1, t, f1_lims(1), f1_lims(2))
% Do the same for ‘f2’:
F2 = int(exp(-j*w*t) * f2, t, f2_lims(1), f2_lims(2))
% Add them
FT = F1 + F2;
% Plot the result:
figure(1)
subplot(2,1,1)
ezplot(abs(FT), [-10*pi, 10*pi])
subplot(2,1,2)
ezplot(angle(FT), [-10*pi, 10*pi])
Experiment with this on your own to see how the transform changes if the function is symmetrical about t=0 instead ( i.e. f2=2 instead of 0 ) . How would you code a symmetric or asymmetric triangle pulse? Have some fun with it!
Note that the value of the Fourier transform at w=0 is not NaN. Think L’Hôpital’s rule...

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!