How to make a moving data point on a coordinate plane using raw EOG data

2 visualizaciones (últimos 30 días)
I want to visualize a moving point on a coordinate plane using data collected from the eyes. The methods were the subject watched the moving dvd screen and I want to sync that video up with the normalized data using max points record earlier. How would I take the data points from up-down and left-right to create a moving graph?
  1 comentario
Star Strider
Star Strider el 17 de Nov. de 2021
It would help greatly to have some sample data, an explanation of its interpretation, and a clear, reasonably detailed, description of the desired result.
It would likely not be possible in real-time, however quite possible with recorded data.
.

Iniciar sesión para comentar.

Respuestas (1)

Brahmadev
Brahmadev el 16 de Feb. de 2024
A moving plot can be created if you have the raw EOG data recorded with you. You can iteratively call the 'plot' function or 'scatter' function to update the plot. Refer to the example below for a plot with an example EOG data, since I do not have access to your data.
% Number of data points
numPoints = 1000;
% Time vector (assuming a sampling rate of 100 Hz)
t = linspace(0, 10, numPoints);
% Simulate EOG data with saccades and smooth pursuits
eog_signal = zeros(1, numPoints);
saccade_timing = [200, 400, 600, 800]; % Indices where saccades occur
for i = 1:length(saccade_timing)
eog_signal(saccade_timing(i)) = eog_signal(saccade_timing(i)) + randi([-100, 100], 1, 1); % Random saccade amplitude
end
% Add smooth pursuit between saccades
for i = 2:numPoints
if ~ismember(i, saccade_timing)
eog_signal(i) = eog_signal(i-1) + randn * 0.5; % Random walk for smooth pursuit
end
end
% Normalize the sample EOG data between 0 and 1 for plotting
eog_normalized = (eog_signal - min(eog_signal)) / (max(eog_signal) - min(eog_signal));
% Create a figure for the animation
figure;
xlim([0, t(end)]); % Set x-axis limits based on the time vector
ylim([0, 1]); % Set y-axis limits based on the normalized EOG signal amplitude
xlabel('Time (s)');
ylabel('Normalized Amplitude');
title('Simulated EOG Data Animation');
hold on; % Keep the previous plots
% Initialize the line object for the trail
trail = plot(t(1), eog_normalized(1), 'b.-', 'MarkerSize', 6);
% Set the pause time in seconds to control the animation speed
pauseTime = 0.01; % Decrease this value to make the animation faster, increase to make it slower
% Loop through the EOG data to animate the moving plot
for i = 2:length(t)
% Update the line object with all previous points
set(trail, 'XData', t(1:i), 'YData', eog_normalized(1:i));
% Plot the current point as a larger dot to represent the "head" of the trail
head = scatter(t(i), eog_normalized(i), 'bo', 'filled');
drawnow; % Update the plot
% Pause for a short time to control animation speed
pause(pauseTime); % Adjust this pause time as needed for your animation speed
% Optionally, delete the head to avoid heavy memory usage
delete(head);
end
hold off; % Release the hold on the current plot
For better synchronization, you can play with the 'pauseTime' according to your original DVD video.
Hope this helps in resolving your query!

Categorías

Más información sobre Just for fun en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by