Borrar filtros
Borrar filtros

How do I find the Fourier series of a Sawtooth wave?

16 visualizaciones (últimos 30 días)
bribee
bribee el 22 de Mayo de 2017
Respondida: Star Strider el 22 de Mayo de 2017
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?

Respuestas (1)

Star Strider
Star Strider el 22 de Mayo de 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.

Community Treasure Hunt

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

Start Hunting!

Translated by