Calculation of rise time of skin conductance data
6 views (last 30 days)
Show older comments
Vida Greyson
on 25 Oct 2021
Commented: Star Strider
on 7 Nov 2021
Hello Matlab experts,
To calculate the rise time of Skin Conductance Response, I used the risetime (x) function in Matlab but it does not calculate the risetime correctly. Could you please help me how to solve this. My supervisor suggested me to calculate the derivative of the signal (which takes the peak velocity of the signal) and I do not know how to do so.
I have attached the data.
Dataset expalanation:
There is one observation point per second in each column- Starts from 0 time to 25 s post stimulus, the risetime happens between 1 to 3 s and the rise time length is between 1 to 3s itself.
I need a simple code (with the loop function) that calculates the derivatie of each row of data and save the derivates of all rows.
Your help is highly appreciated,
Thank you very much,
0 Comments
Accepted Answer
Star Strider
on 25 Oct 2021
The data are certainly available, however making sense out of them is difficult.
Is there a time vector?
The risetime function will not work here, because this is not a bilevel waveform. It is necessary to interpolate to get the appropriate values.
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/778048/SCR.xlsx', 'VariableNamingRule','preserve')
figure
plot(T1{:,2})
grid
title('First Column')
tv = linspace(0, 1, numel(T1{1,2:end})); % Create Time Vector
[maxval,maxidx] = max(T1{1,2:end}); % First Peak & Index
rise = (T1{1,maxidx}-T1{1,2})*[0.1 0.9]; % Rise Levels
RefLvls = interp1(T1{1,2:maxidx}, tv(1:maxidx-1), rise); % Associated Time
figure
plot(tv, T1{1,2:end})
hold on
plot(RefLvls, rise,'+r')
plot(([1;1]*RefLvls), ([1;1]*ylim)', '--r')
hold off
grid
xlabel('Time')
ylabel('Amplitude')
title('First Row')
text(mean(RefLvls),mean(ylim), sprintf('Rise Time = %.5f',diff(RefLvls)), 'Horiz','center', 'Vert','middle', 'Rotation',90)
This should be an appropriate start. Define the appropriate time vector first.
.
2 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!