Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Matlab FFT function plot giving no output

Status
Not open for further replies.

susane

Newbie level 6
Joined
Apr 12, 2016
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
128
Hello guys
I have some ECG data that you can see in the figure,
i am using this simple code to plot the magnitude spectrum in matlab using FFT function,
but i am not able to understand the plot,
Where in this plot is my required ECG signal?
sampling frequency in 125Hz.
This is an ECG signal and the heart beat should be between 1Hz to 1.7 Hz. but i am not able to see that in the FFT
I need help, if some one can explain this on a very basic level

FFT.jpg

Raw_Data_ECG.jpg

Code:
plot(abs(fft(signal)))
xlabel('Frequency (Bins - almost!)')
ylabel('Magnitude');
title('Double-sided Magnitude spectrum');
axis tight
 

Hi,

if you want to find out the heart beat rate with the FFT result ... it will be difficult. (If so: what frequency resolution do you expect?)

The ECG signal seems not to be filtered to attenuate mains frequency.

It is expectable, that you need a window function before performing an FFT.

What FFT window size (sample count) do you use?

Klaus
 

the frequency of heart beat signal should be between 1hz to 1.8 Hz

my sampling rate is 125 sps
 

Hi,

we knew this before.

What about fiilter?
What about resolution?
What about window function?
What about FFT array size?

Klaus
 

The FFT function is not suited for measuring the BPM signal as Klaus mentioned, unless your focus of interest was another, such as analyzing the scattering pattern of the beat hart along the time ( whatever the health meaning of that ), but in this case you should take a big data stream.

By the way, if you are measuring a signal with a rate of around 1 Hz, the full scale of ~550Hz at above graph is compressing any information, making it impossible to know if the code is working or not. MATLAB has functions that allow you define customized range for plotting.
 

Hi,

By the way, if you are measuring a signal with a rate of around 1 Hz, the full scale of ~550Hz at above graph is compressing any information, making it impossible to know if the code is working or not. MATLAB has functions that allow you define customized range for plotting.

I agree.

But there must be a scaing error.
If the sample rate is 125Hz, then the max FFT output bin frequency is close to 62.5Hz.
You won´t get frequency information above 62.5Hz.

Klaus
 
Hi susane,

Let's start with your very first question:

Where in this plot is my required ECG signal?

You signal has a great DC content (more than 350 counts) in comparison with its variations (peaks of 10 to 15 counts).
In your spectrum, the dc is visible as the line at the first bin (zero frequency) with maximum height.
The other components are small in the scale of the graphics, but they are there.
You can explore the details of the plot using zoom, but I advice these things:

a) remove the DC content before performing fft:
signal_noDC = signal - mean(signal);
plot(abs(fft(signal_noDC)));

b) plot a semilogy graphics, or plot in dB:
dftSignal_dB = 20*log10(abs(fft(signal)));
plot(dftSignal_dB);

Please try both and see what you get.

Z
 
  • Like
Reactions: susane

    susane

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top