Taking the derivative of an Action Potential to find the inflection point

3 次查看(过去 30 天)

Hello,

MATLAB newbie here, please go easy on me. I need to determine the slope of a membrane depolarization before the marked inflection point in this voltage vs. time graph:

The purpose is to compare the pre-inflection point slopes of several action potentials. The recording was taken at 20kHz. Since this is discrete data, would it be possible to take a derivative of the data so that I can observe when the slope changes? I'd rather not do this arbitrarily.

Thanks

采纳的回答

Stefan
Stefan 2011-3-8
Thanks for the response! I've gotten MATLAB to define dy. Both y and t are (301x1 double), however dy comes out as (300x1 double).
This means that I can't plot (dy, t), and I'm also losing a data point somewhere. I suppose by definition, taking diff(y) of n will have n-1 time points. I'll try removing a point from t to make it (300x1 double) as well.
  2 个评论
Matt Tearle
Matt Tearle 2011-3-8
Yes, that's expected because it's a finite difference approximation -- the derivative at t is approximated using y(t) and y(t+dt). This means there's no derivative for the last t value. (Or you can shift t by one and think of it as a backward difference, so there's no derivative for the first point.) The simplest solution is just plot(t(1:end-1),dy). But if you really want all 301 derivatives, you'll have to use a different finite diff approximation for the last point... but you could just use a backward difference there, in which case the derivative at the 301 point is the same as the 300th:
dy = zeros(size(y));
dy(1:end-1) = diff(y)*Fs;
dy(end) = dy(end-1);
plot(t,dy)

请先登录,再进行评论。

更多回答(2 个)

Matt Tearle
Matt Tearle 2011-3-3
Approximate derivative of a discrete signal y (with discrete independent variable t) can be obtained using
dy = diff(y)./diff(t)
If you want more accuracy, you'd need to find a higher-order finite difference formula.
In your case, the sampling is, presumably, uniform (20kHz), so you can just do
Fs = 2e4;
dy = diff(y)*Fs;
Another approach would be to perform some kind of interpolation or local least-squares fit, then use the interpolant to determine the derivative. This works better if the signal is noisy.

andy
andy 2014-12-3
hi, @stevan, can you give your script about action potential ?
  1 个评论
Stefan
Stefan 2014-12-3
Absolutely!
Attached is the function that I ended up with. It takes the sample rate in kHz (I use 50), the voltage trace, and an onset time (when the postsynaptic potential begins, I use 0.6).
I'm also attaching a sample spike that works with this code, marked 'V'. I commented it fairly well on my first pass through, but feel free to ask questions if you get stuck.
To run the script, load V into your workspace, and input this command:
V_thresh_fun3(50,V,.6);
All the best,
Stefan

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by