Comments on: Plot FFT using Matlab – FFT of sine wave & cosine wave https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/ Signal Processing for Communication Systems Mon, 07 Mar 2022 11:48:11 +0000 hourly 1 https://wordpress.org/?v=6.7.2 By: Vamsi Krishna Reddy Anyam https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-46141 Mon, 07 Mar 2022 11:48:11 +0000 http://www.gaussianwaves.com/?p=6771#comment-46141 Thank you for such an elaborate explanation.

]]>
By: Mathuranathan https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-30446 Fri, 31 Mar 2017 07:17:00 +0000 http://www.gaussianwaves.com/?p=6771#comment-30446 In reply to Muna Shehan.

Just assign the signal contents to the variable x and the call the FFT routine as mentioned in the post
X=fft(x,NFFT); %x is your signal,

you can use any of the different representations to plot the FFT output.

]]>
By: Muna Shehan https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-30445 Fri, 31 Mar 2017 02:08:00 +0000 http://www.gaussianwaves.com/?p=6771#comment-30445 https://uploads.disquscdn.com/images/d7f7499d564689bb015bdbbb0b86a039eff7d59c75d957cb5453db12b75e4543.jpg Hi all; this article for a sine wave signal. what can i do if the signal is still sine wave with five cycles where each cycle amplitude is less than the previous cycle until the wave is decay at a specific time, and if the x value is represented by a vector which contain the data ( I mean x is not represented by equation). My question how i can implemented fft for my signal.
Thanks in advance

]]>
By: Mohand https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-29572 Fri, 27 May 2016 10:19:00 +0000 http://www.gaussianwaves.com/?p=6771#comment-29572 Hi everybody,

I need to do fft to obtain the frequency content of my signal and calculate the energy to obtain the transmission coefficient, but I have a lot of problems since I don’t know exatly what is the correct way to obtain everything with a correct scale and units.

I have an output signal (voltage vs time : size(u)=(100000,2)) obtained from excitation: pulse (pulse width = 100 µs); on the oscilloscope : duration is 10 ms and 10 MSa/s of sampling rate.

for the frequencies, I expect to get a fundamental at around 8 KHz and the harmonics (2nd and third).

this is a very smal part of my signal :
t(s) t(volts)
3.99000000E-02 1.3574E-02
3.99001000E-02 1.4299E-02
3.99002000E-02 1.3969E-02
3.99003000E-02 1.3508E-02
3.99004000E-02 1.3706E-02

My questions are:

I need the values of the frequencies pics (fundamental, 2nd and 3rd) and calculate the energy of power in order to get the transmission coefficient of the signal.

1 – how should I proceed to get the frequencies in a correct scale? (plot of all the Spectrum in linear scale – Spectrum in dB scale)

2 – is it necessary to include a window in the fft ? which is the better one in that case?

P.S: I tried following the method explained in this website; here is my matlab code!!!!
u=load(‘u10.tsv’);
tau = 0.000000099 ;

Nfft=length(u);
w=blackman(Nfft);
u_windowed_temp=u;
u_windowed=u.*w;

Y1 = fft(u_windowed,Nfft);
%freq1(1)=10^-10;
freq1(2:Nfft/2)=(1:Nfft/2-1)/(Nfft*tau);
plot(freq1/1000,abs(Y1(1:length(freq1))))
thank’s a lot!

]]>
By: Mathuranathan https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-28954 Sat, 26 Dec 2015 13:42:00 +0000 http://www.gaussianwaves.com/?p=6771#comment-28954 In reply to ArrozConCostra.

Thanks for pointing it out

]]>
By: Mathuranathan https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-28952 Sat, 26 Dec 2015 13:02:00 +0000 http://www.gaussianwaves.com/?p=6771#comment-28952 In reply to Yamuna.

I was plotting the NON-normalized magnitude spectrum. The amplitude is influenced the number of samples taken to compute DFT. For normalized magnitude spectrum please check the following post.
https://www.gaussianwaves.com/2015/11/interpreting-fft-results-obtaining-magnitude-and-phase-information

]]>
By: Yamuna https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-28950 Fri, 25 Dec 2015 05:20:00 +0000 http://www.gaussianwaves.com/?p=6771#comment-28950 Hi Sir,

In the above example when I gave the number of cycles as 10, then it is giving a spectrum which has a higher amplitude. This seems so strange to me because the number of cycles is just a visualisation parameter and that should not chance the appearance of the spectrum.

nCyl = 10; %to generate ten cycles of sine wave

Kindly explain why this is happening.

]]>
By: ArrozConCostra https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-28176 Sun, 09 Aug 2015 13:15:00 +0000 http://www.gaussianwaves.com/?p=6771#comment-28176 In reply to Antonis Tsiflikiotis.

I would ask why he does not divide only by L, as this is the usual scaling factor when calculating FFT

]]>
By: ArrozConCostra https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-28175 Sun, 09 Aug 2015 13:08:00 +0000 http://www.gaussianwaves.com/?p=6771#comment-28175 Thanks very much, very explanatory article

There’s an error on point 3. It should read
X=fftshift(x,NFFT); %compute DFT using FFT

Rgds

]]>
By: Antonis Tsiflikiotis https://www.gaussianwaves.com/2014/07/how-to-plot-fft-using-matlab-fft-of-basic-signals-sine-and-cosine-waves/#comment-27916 Thu, 04 Jun 2015 12:03:00 +0000 http://www.gaussianwaves.com/?p=6771#comment-27916 Hi!
Can you plean explain me why in Psd:
Px=X.*conj(X)/(NFFT*L)

you divide by (NFFT*L) and not L^2?

]]>