How do I find the Fourier series of a Sawtooth wave?
16 views (last 30 days)
Show older comments
I have the following sawtooth wave function :
T = 2* 4; Fs = 1000; dt = 1/Fs; t=-5:dt:T-dt; x = -sawtooth (pi/2*t, 0.5); plot(t,x) grid on axis ([-5 5 -1.5 1.5]);
I am having a hard time finding the Fourier series and coefficients. Where do I even begin?
0 Comments
Answers (1)
Star Strider
on 22 May 2017
Try this:
T = 2* 4;
Fs = 1000;
dt = 1/Fs;
t=-5:dt:T-dt;
x = -sawtooth (pi/2*t, 0.5);
figure(1)
plot(t,x)
grid on
axis ([-5 5 -1.5 1.5]);
Fn = Fs/2; % Nyquist Frequency
N = length(t);
FTx = fft(x)/N; % Fourier Transform
Fv = linspace(0, 1, fix(N/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(2)
plot(Fv, abs(FTx(Iv))*2)
grid
xlabel('Frequency')
ylabel('Amplitude')
title('Fourier Transform of Sawtooth Wave')
axis([0 15 ylim])
The coefficients are in ‘FTx’ with respect to each frequency in the ‘Fv’ vector. The coefficients of the cosine component are the real values, and the coefficients of the sine component are the imaginary values.
0 Comments
See Also
Categories
Find more on 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!