필터 지우기
필터 지우기

Discrete Fourier series problem

조회 수: 20 (최근 30일)
Gabriel Maia
Gabriel Maia 2019년 6월 14일
댓글: Muna Awajan 2020년 5월 1일
Hi
I need to plot y[n]=y=1+cos(2*pi*n/N+pi/2) in discrete time and plot the calculate the Fourier coefficients in dicrete time and plot it. But i don't have the period N. How can I do this in Matlab?
Here is the code I tried to do, but it's incomplete so far.
clear
clc
N=??; %Feriod
n=0:1:??; %Discrete Time
y=1+cos(2*pi*n/N+pi/2); %Discrete function
subplot(2,1,1);
stem(n,y) %Plot discrete function
FourierCoef = fft(y); %Fourier series function
subplot(2,1,2);
stem(n,real(FourierCoef),'k'); %Plot Fourier real coefficients

채택된 답변

James Browne
James Browne 2019년 6월 15일
Greetings,
Are you sure that you have the right general equation for y? The function looks odd to me, when I consider the general form of the cosine function:
y = offset + amplitude*cos( angularVelocity * time + phaseShift )
For the above case, your parameters would be:
offset = 1
amplitude = 1
angularVelocity = 2*pi (radians/sec)
time = n
phaseShift = pi/2 (radians)
period = (2*pi) / (angularVelocity)
= (2*pi) / (2*pi rad/sec)
= 1 second
Ther period should not appear in the cosine function (at least I have never seen it in that configuration). Additionally, your process for evaluation the FFT of the signal is wrong. It is actually quite tricky to use the FFT function, however the MATLAB help page has some good examples, found here:
Additionally, I often refer to this youtube video when using FFT in MATLAB. The video is old and the user interface looks very different than modern versions of MATLAB but the syntax is the same:
Hope this helps. Cheers~
  댓글 수: 3
James Browne
James Browne 2019년 6월 15일
편집: James Browne 2019년 6월 15일
Correct, and the fast Forier transform is the frequency, amplitude and angle information of all of the coefficients in the disctrete Fourier seriese......so once you look at the FFT results and pick out the dominant signal data, you can use ifft() to transform that data back into a time domain signal, pretty sure the youtube video that I sent you the link for, covers that.
Muna Awajan
Muna Awajan 2020년 5월 1일
fft: Discrete fast Fourier transform

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by