Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Looking for FFT of pulses train

Status
Not open for further replies.

EngIntoHW

Member
Hi,

I tried to create FFT of 10% Duty-Cycle Pulses train, but failed to do so.

Do you know where one can be found?

Thanks!
 
What do you mean by create FFT?
Do you need to do FFT analysis on a signal?
Our SCANALOGIC-2 does exactly that. you can download ScanaStudio from our website, generate some 10% pwm signals, and build FFT graphs..
 
Last edited:
Hi ikalogic,

I'm familiar with your awesome software actually.
However, PWM isn't an impluse train, because an impluse train consists of impluses of the same width, which is 10% of the period, you see?
 
here is some Matlab code and screenshots:

Code:
function FFT_test

%% ********************************************
%%      Basic example of FFT in MATLAB
%%          provided by panic mode
%% ********************************************

clc; clear all; close all; % always start fresh,
                           % reset and close anything that may be open

L = 2000;                  % length of signal (number of sample values)
f1  = 10000;               % set signal frequency
Duty = 10;                 % set duty of square wave             
Fs = 512000;               % recall Nyquist sampling frequency, it must be
                           % at least twice that of sampled signal
                           % but it is better if it is higher than that

for i=1:L                  % create pulse train with given duty cycle
    if mod(i,100)<Duty
        signal(i)=1;
    else
        signal(i)=0;
    end;
end;

    
T  = 1./Fs;                % sampling period
t  = [0:L-1]*T;            % time scale for time domain
f = Fs/2*linspace(-1,1,L); % frequency scale for freq. domain

FFTsignal = fft(signal)/L; % fft of signal (freq domain)

figure();                  % always create new figure for your plots

subplot(2,1,1),plot(t,signal); % top graph is time domain signal
axis([t(1) t(L) -0.25 1.25]);   % set convenient axis limits for plot
title('Signal in time domain'); % indicate what the plot represents

subplot(2,1,2),plot(f,abs(fftshift(FFTsignal))); % bottom is freq. domain 
title('Signal in frequency domain'); % indicate what the plot represents
 
Okay.. that looks nice..

so where is the problem exactly? :)

I recall your first post:
I tried to create FFT of 10% Duty-Cycle Pulses train, but failed to do so.
i still don't get what you mean by "create an FFT"? you seem to be doing just fine with matlab..
 
?

you may be confusing EngIntoHW and me.... ;)
 
forgot to mark screen captures but file names indicate the content (they are 10%, 25%, 50% and 97% duty cycle).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top