How do I find the Fourier series of a Sawtooth wave?
16 次查看(过去 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 中查找有关 Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!