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

2 visualizzazioni (ultimi 30 giorni)
Nick Doherty il 17 Nov 2021
Risposto: Brahmadev il 16 Feb 2024
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 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Star Strider il 17 Nov 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.
.

Accedi per commentare.

### Risposte (1)

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);
end
for i = 2:numPoints
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
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!
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Calendar in Help Center e File Exchange

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by