PLOTTING A SINE WAVE USING TRIGNOMETRIC FOURIER SERIES

3 ビュー (過去 30 日間)
Devika Sunil
Devika Sunil 2020 年 5 月 3 日
コメント済み: Devika Sunil 2020 年 5 月 3 日
  2 件のコメント
Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020 年 5 月 3 日
What have you tried so far?
Devika Sunil
Devika Sunil 2020 年 5 月 3 日
I tried to plot the waveform using fourier function, but I'm new to MATLAB and don't know how to proceed.

サインインしてコメントする。

回答 (1 件)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020 年 5 月 3 日
You have an analytical waveform, so you can generate it for 4 cycles without using any fourier function. Then, if you use the fft function you can become the coefficients (The results are complex numbers, how do they related with sin and cos?). Also, to plot the approximation with a reduced number of coefficients you can simply set all the unwanted coefficients to 0 (why?). Here is an example implementation that will plot some approximations of your waveform as a function of the number of coefficients:
% Analytical waveform
t = 0:1/100:2*pi-1/100;
y = exp(-t);
y = [y,y,y,y]; % 4 cycles
t = 0:1/100:2*pi*4-2/100;
NofCoeff = 60;
figure
plot(t,y)
FFT = fft(y);
FFT(NofCoeff+1:end) = 0; % Remove unwanted coefficients
hold on
plot(t,ifft(FFT,'symmetric'))
legend({'Analytical function',['Fourier with ',num2str(NofCoeff),' coeff']})

カテゴリ

Help Center および File ExchangeWaveform Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by