Finding the average derivative across a region of data
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I have two noisy datasets plotted on the same time axis, one of which is more of a "independant" variable with many spikes and peaks. I am trying to find the average derivative of the dependant dataset between the start and the peak of the independant dataset. I already have the spike starts and peaks appropriatly identified.
Here is what I have so far:
for i=1:numSpk
dydx = gradient(parameter(closestIdx_Start(i):closestIdx_Peak(i))) ./ gradient(time(closestIdx_Start(i):closestIdx_Peak(i)));
avg_deriv(i) = mean(dydx);
end
(note: I am using the 'closestIdx' variables because the two datasets had different sampling rates, so I found the closest time stamp in the dependant set to the identified points in the independant set).
I am not getting any warnings or errors when I run this, but the results I am getting are not makeing much sense. I expected most/all average derivatives to be positive and I am getting an even mix of positive and negative values. I am not sure if my results are simply due to noise in the data, or if I have a logic issue above.
Any thoughts greatly apprecaited!
0 comentarios
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!