How do I find the Fourier series of a Sawtooth wave?
조회 수: 7 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File 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!