Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Different plot shape for fft depending on time sample spacing

Different plot shape for fft depending on time sample spacing

Different plot shape for fft depending on time sample spacing


I am having the following issue. I am trying to analyse the input and output signal of my filter using fft. However, I am not sure if my fft is correct. My input signal is the product of a sawtooth and sine waveforms both with frequencies 6kHz and 32kHz, respectively. Both individual signals have an amplitude of 1 before being multiplied.
Depending on my time values I get different result for my fft plots. If I use values of time spaced out by the period of my sampling frequency, I get a "nice" looking graph with clear peaks as you would expect in a Fourier Transform (see Fig.1). However, if I use values of time spaced out by the period of the signal being sampled, the graph has more frequency components (see Fig. 2). I really don't know which graph is correctly displays my FFT. Also I have the problem that I used an online tutorial to achieve my FFT but I do not understand why the guy did what he did in his code which I do not understand. However, if I plot the absolute values of FFT, I get graphs with similar shapes but the amplitudes jump up to 30 or 40 more (see Fig. 3 and 4). Also for Fig.2 why is there a small wiggle at the start of the filtered signal (time domain) vs time ? Please your help in performing FFT accurately would be of great help. Thanks in advance.

CODE --> Matlab

%Time values using sampling frequency period.
fsampling = 80000;
tsampling = 0:1/fsampling:5000000*Tsampling;

%Time values using sawtooth frequency period.
fsampling = 80000;
fsawtooth = 6000;
Tsawtooth = (1/fsawtooth);
tsawtooth = 0:1/fssampling:20*Tsawtooth;

 %Piece of code to use FFT that I don't understand.
 L0 = length(product); 
 NFFT0 = 2^nextpow2(L0);
 Y0 = fft(product,NFFT0)/L0;
 FreqDom0 = fs/2*linspace(0,1,NFFT0/2+1);

%Performing FFT using just abs.
 IPFFT = abs(fft(product));
 plot(t, IPFFT);
 plot(FreqDom0, 2*abs(Y0(1:NFFT0/2+1))); 

RE: Different plot shape for fft depending on time sample spacing

You should either use the file upload facility provided or the image insertion facility. You can upload more than one file at a time, you just have to copy the links manually and paste them into your post.

My company, as do others, blocks all other forms of file sharing sites.

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


eBook - Rethink Your PLM
A lot has changed since the 90s. You don't surf the Web using dial-up anymore, so why are you still using a legacy PLM solution that's blocking your ability to innovate? To develop and launch products today, you need a flexible, cloud-based PLM, not a solution that's stuck in the past. Download Now
White Paper - Using Virtualization for IVI and AUTOSAR Consolidation on an ECU
Current approaches used to tackle the complexities of a vehicle’s electrical and electronics (E/E) architecture are both cost prohibitive and lacking in performance. Utilizing virtualization in automotive software architecture provides a better approach. This can be achieved by encapsulating different heterogeneous automotive platforms inside virtual machines running on the same hardware. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close