% Part 2 – reaction to audio stimuli % SIMPLE REACTION TIME - sound %- in random time intervals (1-10 sec., 2 times) %- in regular time intervals (4 sec., 2 times) msgbox('SIMPLE REACTION TIME to audio stimulus. Press any key after hearing the sound.') times=ceil(10*rand(1,10)); sprintf('Get ready for part 1 and press any key...') pause for i=1:10 pause(times(i)) soundsc(rand(500,2)) tic pause segment1_times(i)=toc; end times=ceil(10*rand(1,10)); sprintf('Get ready for part 2 and press any key ...') pause for i=1:10 pause(times(i)) soundsc(rand(500,2)) tic pause segment2_times(i)=toc; end sprintf('Get ready for part 3 and press any key ...') pause for i=1:10 pause(4) soundsc(rand(500,2)) tic pause segment3_times(i)=toc; end sprintf('Get ready for part 4 and press any key ...') pause for i=1:10 pause(4) soundsc(rand(500,2)) tic pause segment4_times(i)=toc; end clear i times segment1_times s1 = mean(segment1_times) segment2_times s2 = mean(segment2_times) segment3_times s3 = mean(segment3_times) segment4_times s4 = mean(segment4_times) plot(segment1_times) hold on plot(segment2_times) plot(segment3_times) plot(segment4_times) legend('RAND1','RAND2','EQ1','EQ2') xlabel('sample/probka') % x-axis label ylabel('time/czas [s]') % y-axis label