Calculation of rise time of skin conductance data

5 visualizaciones (últimos 30 días)
Vida Greyson
Vida Greyson el 25 de Oct. de 2021
Comentada: Star Strider el 7 de Nov. de 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,

Respuesta aceptada

Star Strider
Star Strider el 25 de Oct. de 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')
T1 = 1775×27 table
ParticipantID Zero One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve Thirteen Fourteen Fifteen Sixteen Seventeen Eighteen Nineteen Twenty twentyone Twentytwo Twentythree Twentyfour Twentyfive _____________ _________ _________ __________ ________ ________ ________ ________ ________ ________ ________ ________ ________ ________ ________ ________ ________ ________ _________ ________ ________ ________ _________ _________ ___________ __________ __________ {'i6ef19xt'} -0.00013 0.000318 0.000669 0.001844 0.001876 0.001696 0.001535 0.001718 0.001178 0.000972 0.001491 0.001445 0.00117 0.001285 0.001191 0.001049 0.001212 0.000853 0.000766 0.000928 0.000666 0.000855 0.000867 0.000529 0.000426 0.00049359 {'i6ef19xt'} 0.000157 0.00034 0.000514 0.004069 0.003753 0.004665 0.004652 0.004124 0.003611 0.002678 0.002146 0.002194 0.001275 0.001092 0.004428 0.006963 0.007007 0.006311 0.005216 0.003792 0.001675 0.000838 0.000453 0.000313 0.000262 0.00029941 {'i6ef19xt'} -0.000415 -0.00054 -0.000458 0.000312 0.000347 0.000196 0.000246 0.000469 0.000447 0.000284 0.00028 0.00048 0.000485 0.000745 0.000749 0.00095 0.001249 0.001195 0.000672 0.001155 0.004676 0.004088 0.003481 0.002439 0.001515 0.00065515 {'i6ef19xt'} -0.000837 -0.000269 -0.000598 0.002262 0.004064 0.005268 0.004625 0.003763 0.003337 0.002087 0.001594 0.001931 0.001983 0.001353 0.00086 0.000745 0.000369 6.4e-05 0.00037 0.000615 0.004278 0.003333 0.003501 0.00334 0.002924 0.0019433 {'i6ef19xt'} -0.000262 -0.000653 -0.00053 0.000954 0.000954 0.000554 0.000626 0.001055 0.001353 0.001328 0.001205 0.001879 0.001227 0.000774 0.000629 0.000873 0.001162 0.000811 0.000691 0.000762 0.00277 0.003144 0.003223 0.003377 0.0037 0.0035897 {'i6ef19xt'} -0.000106 -0.000663 -0.000158 0.001541 0.001325 0.00103 0.00151 0.00172 0.002208 0.002072 0.001351 0.000934 0.001703 0.001564 0.001978 0.002372 0.002317 0.002259 0.001635 0.001393 0.003659 0.003666 0.003394 0.00267 0.001328 0.0010741 {'i6ef19xt'} -7.6e-05 0.00022 -0.000198 0.000772 0.000827 0.00054 0.000901 0.00202 0.001353 0.000641 0.000566 0.00047 0.000509 0.000772 0.000894 0.000928 0.000811 0.000802 0.000669 0.000724 0.002013 0.001861 0.002052 0.00105 0.001736 0.0041724 {'i6ef19xt'} -0.000321 -3.2e-05 -0.000632 0.004844 0.016699 0.017774 0.015493 0.01328 0.011465 0.009262 0.007351 0.005364 0.003806 0.002898 0.001611 0.000769 0.00089 0.001225 0.00194 0.002552 0.000701 0.001303 0.00174 0.00205 0.002117 0.0017208 {'i6ef19xt'} 0.000212 -0.000139 -8.8e-05 0.002591 0.001551 0.000831 0.000587 0.000727 0.003241 0.00515 0.005416 0.004814 0.003785 0.003133 0.002448 0.00274 0.004133 0.004453 0.004379 0.00455 0.001176 0.000786 0.001033 0.000972 0.001261 0.0023003 {'i6ef19xt'} -0.000468 -0.00095 -0.0003622 0.00212 0.00248 0.00312 0.004759 0.006155 0.006803 0.008193 0.008944 0.009351 0.010213 0.010311 0.009923 0.009008 0.008055 0.00782 0.007436 0.006797 0.006036 0.005273 0.006113 0.006052 0.005516 0.0050616 {'i6ef19xt'} 1e-06 8e-05 0.000233 0.00093 0.000804 0.000881 0.000811 0.00043 0.000767 0.000838 0.000607 0.000719 0.000761 0.000869 0.001042 0.000699 0.000697 0.000959 0.000714 0.000486 0.001089 0.001172 0.001399 0.001578 0.001669 0.0015821 {'i6ef19xt'} -0.00031 -0.000256 -7.5e-05 0.000568 0.00074 0.000834 0.001041 0.001059 0.000785 0.000683 0.001037 0.000906 0.000551 0.000819 0.001158 0.001051 0.000864 0.000874 0.001 0.000777 0.001936 0.001771 0.001469 0.001452 0.001156 0.0010073 {'i6ef19xt'} 1e-05 2e-05 0.000968 0.006066 0.005558 0.005162 0.003542 0.00299 0.002557 0.002485 0.002231 0.001959 0.002487 0.003447 0.003486 0.003661 0.003897 0.002536 0.001103 0.001192 0.002534 0.00309 0.003647 0.004369 0.005119 0.0056723 {'i6ef19xt'} -0.000337 -0.000717 -0.000424 0.001943 0.001693 0.001908 0.002239 0.002444 0.002555 0.002087 0.001602 0.001717 0.001353 0.001493 0.002009 0.002727 0.00351 0.003458 0.003822 0.004713 0.002391 0.00359 0.003725 0.003138 0.00277 0.0029082 {'i6ef19xt'} -0.000915 -0.000747 -0.000309 0.001137 0.001069 0.001364 0.001607 0.002066 0.002133 0.00145 0.001118 0.00111 0.000756 0.000144 0.001264 0.002884 0.003748 0.003054 0.001735 0.001195 0.006026 0.003559 0.002032 0.001143 0.00069 0.00045339 {'i6ef19xt'} 9e-06 0.000349 0.000507 0.00113 0.000723 0.000582 0.000601 0.00057 0.000507 0.000465 0.000472 0.000718 0.000444 0.000486 0.000464 0.000456 0.000221 0.000558 0.000605 0.00029 0.000451 0.000202 0.00038 0.00065 0.000377 0.00048936
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 comentarios
Vida Greyson
Vida Greyson el 7 de Nov. de 2021
Fantastic community! Thank you very much for your time.
Star Strider
Star Strider el 7 de Nov. de 2021
As always, my pleasure!
.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by