FFT produces flat Transfer Function
Mostra commenti meno recenti
I have a model of a neuron, which can be injected with current, and responds by generating action potentials. The sample-time step of my simulations is 0.025ms.
Preliminary simulations show that the neuron filters out frequencies of around 40-70Hz. I therefore want to obtain a transfer function for my neuron, and show that the gain dips for these frequencies. To do this I played white noise in the model, and used matlabs FFT function.
I use the following code:
% Data file N contains column 1 of time, column 2 of neuron data.
Fs = 40000; % Sampling frequency: 0.025ms=40000Hz
T = 1/Fs; % Sample time
t=N.data(:,1); % Time
v=N.data(:,2); % Data
% Sum of a 50 Hz sinusoid and a 120 Hz sinusoid
% plot(t,v);
Y = fft(v);
Y(1)=[]; % Sum of components; can be removed.
n=length(Y);
power = abs(Y(1:floor(n/2)));
nyquist = 200; % Means transfer function ranges for 0-100Hz, as desired.
freq = (1:n/2)/(n/2)*nyquist;
plot(freq,power)
Trouble is, the plot comes back completely flat, apart from a very large peak (8e5) in power for very small (0-0.1Hz) frequencies. What am I doing wrong with my MATLAB code? Should I be injecting periodic signals instead of white noise?
Thanks,
Linford
Risposta accettata
Più risposte (2)
Rick Rosson
il 23 Mar 2012
0 voti
What is the value of n=length(Y)?
1 Commento
Linford Briant
il 23 Mar 2012
Amaya
il 30 Dic 2014
0 voti
I had the same problem with some data I was analysing. This problem seems to be caused by th DC offset of the signal which I removed by doing
your_signal=your_signal-mean(your_signal)
and then performing any fft operation on it. I am not sure why this happens (mathematically), but would love to know if anyone has an answer!. Thanks.
Categorie
Scopri di più su Vibration Analysis in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!