Assigning randomized values (of a linspace range using randperm) to an empty vector for posterior graphing?
Afficher commentaires plus anciens
Hello, The following code plays two beeps with a pause between them. The pause may vary within a range defined by linspace. Then randperm, randomizes the pauses. What 'c' does is combine both the functions mentioned before, in some sort of indexing device (pardon my novice-ness). When the programme ends, c displays the last randomized duration value of the range .
What I need is to graph all the user's inputs in a graph that compares them with the duration values. The problem is that when 'c' is plotted, it only shows the last duration value, as a small point in the graph.
The thing is supposed to measure the user's timing perception based on the comparison of his inputs and the duration values. It is a neuroscience experiment.
Code:
Fs=8192; %sample rate
y=sin(2*pi*2000*[0:1/Fs:0.5]); %sinewave; rate
a=linspace(0.5,1,5); %pause durations
for b=randperm(5)
c=a(b) %pause's randomization by permutation
sound(y,Fs), pause(c), sound(y,Fs), %sound production
pause,tic, pause, toc %user input; timing measures
end
I hope I was clear enough. Thanks
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 6 Juil 2012
1 vote
Seems like you're looking for the "scatter" function. It plots a scatterplot of one variable, like the user's inputs, against the other variable, like the duration values. Give that a try.
1 commentaire
Juan Pablo
le 9 Juil 2012
Catégories
En savoir plus sur Behavior and Psychophysics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!