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

조회 수: 7 (최근 30일)
bribee
bribee 2017년 5월 22일
답변: Star Strider 2017년 5월 22일
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?

답변 (1개)

Star Strider
Star Strider 2017년 5월 22일
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.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by