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

조회 수: 11 (최근 30일)
Stefan
Stefan 2011년 3월 3일
댓글: Stefan 2014년 12월 3일

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)
Stefan
Stefan 2011년 3월 8일
Wohoo!
http://imgur.com/0BWsK

댓글을 달려면 로그인하십시오.

추가 답변 (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에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by